Browse Source

Revert "Fixed AdminType delete checkboxes (#4358)"

This reverts commit 46a6ab196a2270d480851715b5f1b1093cb6671a.
Grégoire Paris 8 years ago
parent
commit
6fd6e6ad15

+ 1 - 10
Form/Type/AdminType.php

@@ -46,16 +46,7 @@ class AdminType extends AbstractType
                 $options['delete_options']['type_options']['translation_domain'] = $admin->getTranslationDomain();
             }
 
-            $builder->add(
-                '_delete',
-                $options['delete_options']['type'],
-                array_merge(
-                    $options['delete_options']['type_options'],
-                    array(
-                        'attr' => array('class' => 'sonata-admin-type-delete-checkbox'),
-                    )
-                )
-            );
+            $builder->add('_delete', $options['delete_options']['type'], $options['delete_options']['type_options']);
         }
 
         // hack to make sure the subject is correctly set

+ 0 - 3
Resources/doc/reference/form_types.rst

@@ -502,9 +502,6 @@ btn_add and btn_catalogue:
   corresponding button. You can also specify a custom translation catalogue
   for this label, which defaults to ``SonataAdminBundle``.
 
-When using ``edit: inline`` a delete checkbox will be rendered for each element of the collection.
-Checking it will disable the fields but the form needs to be submitted for the element to actually be removed from the collection.
-
 **TIP**: A jQuery event is fired after a row has been added (``sonata-admin-append-form-element``).
 You can listen to this event to trigger custom JavaScript (eg: add a calendar widget to a newly added date field)
 

+ 1 - 13
Resources/public/Admin.js

@@ -55,7 +55,7 @@ var Admin = {
             padding: 15,
             overflow: 'auto'
         });
-
+      
         jQuery(modal).trigger('sonata-admin-setup-list-modal');
     },
     setup_select2: function(subject) {
@@ -608,17 +608,6 @@ var Admin = {
                 lessLink: '<a href="#">'+jQuery(this).data('readmore-less')+'</a>'
             });
         });
-    },
-    handle_inline_delete_checkboxes: function() {
-        var eventType = window.SONATA_CONFIG.USE_ICHECK ? 'ifChanged': 'change';
-
-        $('.sonata-ba-form').on(eventType, '.sonata-admin-type-delete-checkbox', function() {
-            var id = jQuery(this).prop('id');
-
-            jQuery('[id^=' + id.split('__')[0] + ']:not("#' + id + '")')
-                .prop('disabled', jQuery(this).is(':checked'))
-            ;
-        });
     }
 };
 
@@ -631,7 +620,6 @@ jQuery(document).ready(function() {
     Admin.setup_per_page_switcher(document);
     Admin.setup_collection_buttons(document);
     Admin.shared_setup(document);
-    Admin.handle_inline_delete_checkboxes();
 });
 
 jQuery(document).on('sonata-admin-append-form-element', function(e) {

+ 0 - 3
Resources/views/Form/Type/sonata_type_model_autocomplete.html.twig

@@ -41,9 +41,6 @@ file that was distributed with this source code.
                 dropdownAutoWidth: {{ dropdown_auto_width ? 'true' : 'false' }},
                 containerCssClass: '{{ container_css_class ~ ' form-control' }}',
                 dropdownCssClass: '{{ dropdown_css_class }}',
-                initSelection : function (element, callback) {
-                    callback(element.val());
-                },
                 ajax: {
                     url:  '{{ url ?: path(route.name, route.parameters|default([]))|e('js') }}',
                     dataType: 'json',