Browse Source

Merge branch '2.0' of github.com:sonata-project/SonataAdminBundle into short-object-description-refactoring

Thanos Polymeneas 13 years ago
parent
commit
f09d963b91

+ 4 - 0
CHANGELOG.md

@@ -1,6 +1,10 @@
 CHANGELOG
 =========
 
+### 2012-05-31
+
+* Update batch action confirmation message (breaks some translations)
+
 ### 2012-05-02
 
 * [BC BREAK] add ProxyQueryInterface hint into the FilterInterface class

+ 1 - 1
Controller/CRUDController.php

@@ -376,7 +376,7 @@ class CRUDController extends Controller
                 'action'   => 'list',
                 'datagrid' => $datagrid,
                 'form'     => $formView,
-                'data'     => json_encode($data),
+                'data'     => $data,
             ));
         }
 

+ 5 - 1
Resources/translations/SonataAdminBundle.en.xliff

@@ -184,7 +184,11 @@
             </trans-unit>
             <trans-unit id="message_batch_confirmation">
                 <source>message_batch_confirmation</source>
-                <target>Are you sure you want to confirm this action and execute it for all of the selected elements?</target>
+                <target>Are you sure you want to confirm this action and execute it for the selected element?|Are you sure you want to confirm this action and execute it for the %count% selected elements?</target>
+            </trans-unit>
+            <trans-unit id="message_batch_all_confirmation">
+                <source>message_batch_all_confirmation</source>
+                <target>Are you sure you want to confirm this action and execute it for all the elements?</target>
             </trans-unit>
             <trans-unit id="btn_execute_batch_action">
                 <source>btn_execute_batch_action</source>

+ 5 - 1
Resources/translations/SonataAdminBundle.fr.xliff

@@ -184,7 +184,11 @@
             </trans-unit>
             <trans-unit id="message_batch_confirmation">
                 <source>message_batch_confirmation</source>
-                <target>Êtes-vous sûre de vouloir confirmer cette action et de l'exécuter pour tous les éléments sélectionnés?</target>
+                <target>Êtes-vous sûr de vouloir confirmer cette action et de l'exécuter pour l'élément sélectionné?|Êtes-vous sûr de vouloir confirmer cette action et de l'exécuter pour les %count% éléments sélectionnés?</target>
+            </trans-unit>
+            <trans-unit id="message_batch_all_confirmation">
+                <source>message_batch_all_confirmation</source>
+                <target>Êtes-vous sûr de vouloir confirmer cette action et de l'exécuter pour tous les éléments?</target>
             </trans-unit>
             <trans-unit id="btn_execute_batch_action">
                 <source>btn_execute_batch_action</source>

+ 6 - 2
Resources/views/CRUD/batch_confirmation.html.twig

@@ -32,12 +32,16 @@ file that was distributed with this source code.
 
         <h1>{% trans from 'SonataAdminBundle' %}title_batch_confirmation{% endtrans %}</h1>
 
-        {% trans from 'SonataAdminBundle' %}message_batch_confirmation{% endtrans %}
+        {% if data.all_elements %}
+            {% trans from 'SonataAdminBundle' %}message_batch_all_confirmation{% endtrans %}
+        {% else %}
+            {% transchoice data.idx|length with {'%count%': data.idx|length} from 'SonataAdminBundle' %}message_batch_confirmation{% endtranschoice %}
+        {% endif %}
 
         <div class="actions">
             <form action="{{ admin.generateUrl('batch', admin.filterParameters) }}" method="POST" >
                 <input type="hidden" name="confirmation" value="ok" />
-                <input type="hidden" name="data" value="{{ data }}" />
+                <input type="hidden" name="data" value="{{ data|json_encode }}" />
 
                 <div style="display: none">
                     {{ form_rest(form) }}

+ 1 - 1
Resources/views/Form/form_admin_fields.html.twig

@@ -78,7 +78,7 @@ file that was distributed with this source code.
 
 {% block field_row %}
     {% if sonata_admin is not defined or not sonata_admin_enabled or not sonata_admin.field_description %}
-        {{ parent() }}
+        {{ form_row(form) }}
     {% else %}
         <div class="clearfix{% if errors|length > 0%} error{%endif%}" id="sonata-ba-field-container-{{ id }}">
             {% block label %}