Prechádzať zdrojové kódy

Merge branch 'master' into form

Thomas Rabaix 14 rokov pred
rodič
commit
b749754e5f

+ 2 - 2
DependencyInjection/AddDependencyCallsPass.php

@@ -43,11 +43,11 @@ class AddDependencyCallsPass implements CompilerPassInterface
             $arguments = $definition->getArguments();
 
             if (strlen($arguments[0]) == 0) {
-                $definition->setArgument(0, $id);
+                $definition->replaceArgument(0, $id);
             }
 
             if (strlen($arguments[2]) == 0) {
-                $definition->setArgument(2, 'SonataAdminBundle:CRUD');
+                $definition->replaceArgument(2, 'SonataAdminBundle:CRUD');
             }
 
             $this->applyDefaults($definition, $attributes);

+ 2 - 2
Resources/views/CRUD/action.html.twig

@@ -14,8 +14,8 @@ file that was distributed with this source code.
 {% block actions %}
     <div class="sonata-actions">
         <ul>
-            <li class="sonata-action-element"><a href="{{ admin.generateUrl('create') }}">{% trans "link_action_create" from admin.translationdomain %}</a></li>
-            <li class="sonata-action-element"><a href="{{ admin.generateUrl('list') }}">{% trans "link_action_list" from admin.translationdomain %}</a></li>
+            <li class="sonata-action-element"><a href="{{ admin.generateUrl('create') }}">{% trans from admin.translationdomain %}link_action_create{% endtrans %}</a></li>
+            <li class="sonata-action-element"><a href="{{ admin.generateUrl('list') }}">{% trans from admin.translationdomain %}link_action_list{% endtrans %}</a></li>
         </ul>
     </div>
 {% endblock %}

+ 12 - 12
Resources/views/CRUD/base_edit.html.twig

@@ -14,8 +14,8 @@ file that was distributed with this source code.
 {% block actions %}
     <div class="sonata-actions">
         <ul>
-            <li class="sonata-action-element"><a href="{{ admin.generateUrl('create') }}">{% trans "link_action_create" from admin.translationdomain %}</a></li>
-            <li class="sonata-action-element"><a href="{{ admin.generateUrl('list') }}">{% trans "link_action_list" from admin.translationdomain %}</a></li>
+            <li class="sonata-action-element"><a href="{{ admin.generateUrl('create') }}">{% trans from admin.translationdomain %}link_action_create{% endtrans %}</a></li>
+            <li class="sonata-action-element"><a href="{{ admin.generateUrl('list') }}">{% trans from admin.translationdomain %}link_action_list{% endtrans %}</a></li>
         </ul>
     </div>
 {% endblock %}
@@ -42,9 +42,9 @@ file that was distributed with this source code.
             {% if name %}
                 <fieldset>
                     <legend>
-                        {% trans name %}
+                        {{ name|trans }}
                         {% if form_group.collapsed %}
-                            <a href="" class="sonata-ba-collapsed">{% trans 'link_expand' from 'AdminBundle' %}</a>
+                            <a href="" class="sonata-ba-collapsed">{% trans from 'AdminBundle' %}link_expand{% endtrans %}</a>
                         {% endif %}
                     </legend>
 
@@ -65,18 +65,18 @@ file that was distributed with this source code.
         {% endfor %}
 
         {% if app.request.isxmlhttprequest %}
-            {% if object.id %}
-                <input type="submit" name="btn_update" value="{% trans "btn_update" from admin.translationdomain %}"/>
+            {% if form.data.id %}
+                <input type="submit" name="btn_update" value="{% trans from admin.translationdomain %}btn_update{% endtrans %}"/>
             {% else %}
-                <input type="submit" name="btn_create" value="{% trans "btn_create" from admin.translationdomain %}"/>
+                <input type="submit" name="btn_create" value="{% trans from admin.translationdomain %}btn_create{% endtrans %}"/>
             {% endif %}
         {% else %}
-            {% if object.id %}
-                <input type="submit" name="btn_update_and_edit" value="{% trans "btn_update_and_edit_again" from admin.translationdomain %}"/>
-                <input type="submit" name="btn_update_and_list" value="{% trans "btn_update_and_return_to_list" from admin.translationdomain %}"/>
+            {% if form.data.id %}
+                <input type="submit" name="btn_update_and_edit" value="{% trans from admin.translationdomain %}btn_update_and_edit_again{% endtrans %}"/>
+                <input type="submit" name="btn_update_and_list" value="{% trans from admin.translationdomain %}btn_update_and_return_to_list{% endtrans %}"/>
             {% else %}
-                <input type="submit" name="btn_create_and_edit" value="{% trans "btn_create_and_edit_again" from admin.translationdomain %}"/>
-                <input type="submit" name="btn_create_and_create" value="{% trans "btn_create_and_create_a_new_one" from admin.translationdomain %}"/>
+                <input type="submit" name="btn_create_and_edit" value="{% trans from admin.translationdomain %}btn_create_and_edit_again{% endtrans %}"/>
+                <input type="submit" name="btn_create_and_create" value="{% trans from admin.translationdomain %}btn_create_and_create_a_new_one{% endtrans %}"/>
             {% endif %}
         {% endif %}
 

+ 2 - 2
Resources/views/CRUD/base_filter_field.html.twig

@@ -19,7 +19,7 @@ file that was distributed with this source code.
         <br />
     {% endblock %}
 
-    <div class="sonata-ba-field {% if filter.field.haserrors %}sonata-ba-field-error"{% endif %}">
-        {% block field %}{{ form_widget(filter.field) }}{% endblock %}
+    <div class="sonata-ba-field{% if filter.field.haserrors %} sonata-ba-field-error"{% endif %}">
+        {% block field %}{{ form_field(filter.field) }}{% endblock %}
     </div>
 </div>

+ 10 - 10
Resources/views/CRUD/base_list.html.twig

@@ -14,7 +14,7 @@ file that was distributed with this source code.
 {% block actions %}
     <div class="sonata-actions">
         <ul>
-            <li class="sonata-action-element"><a href="{{ admin.generateUrl('create') }}">{% trans "link_action_create" from admin.translationdomain %}</a></li>
+            <li class="sonata-action-element"><a href="{{ admin.generateUrl('create') }}">{% trans from admin.translationdomain %}link_action_create{% endtrans %}</a></li>
         </ul>
     </div>
 {% endblock %}
@@ -47,9 +47,9 @@ file that was distributed with this source code.
                                         {% if sortable %}<a href="{{ admin.generateUrl('list', sort_parameters) }}">{% endif %}
 
                                         {% if field_description.options.name is defined %}
-                                            {% trans field_description.options.name from admin.translationdomain %}
+                                            {{ field_description.options.name|trans({}, admin.translationdomain) }}
                                         {% else %}
-                                            {% trans field_description.name from admin.translationdomain %}
+                                            {{ field_description.name|trans({}, admin.translationdomain) }}
                                         {% endif %}
 
                                         {% if sortable %}</a>{% endif %}
@@ -76,7 +76,7 @@ file that was distributed with this source code.
                             <td colspan="{{ admin.list.elements|length }}" class="pager">
                                 <ul>
                                     {% if admin.datagrid.pager.page != admin.datagrid.pager.previouspage %}
-                                        <li><a href="{{ admin.generateUrl('list', admin.datagrid.values|merge({'_page': admin.datagrid.pager.previouspage})) }}">{% trans 'link_previous_pager' from 'AdminBundle' %}</a></li>
+                                        <li><a href="{{ admin.generateUrl('list', admin.datagrid.values|merge({'_page': admin.datagrid.pager.previouspage})) }}">{% trans from 'AdminBundle' %}link_previous_pager{% endtrans %}</a></li>
                                     {% endif %}
 
                                     {# Set the number of pages to display in the pager #}
@@ -89,7 +89,7 @@ file that was distributed with this source code.
                                     {% endfor %}
 
                                     {% if admin.datagrid.pager.page != admin.datagrid.pager.nextpage %}
-                                        <li><a href="{{ admin.generateUrl('list', admin.datagrid.values|merge({'_page': admin.datagrid.pager.nextpage})) }}">{% trans 'link_next_pager' from 'AdminBundle' %}</a></li>
+                                        <li><a href="{{ admin.generateUrl('list', admin.datagrid.values|merge({'_page': admin.datagrid.pager.nextpage})) }}">{% trans from 'AdminBundle' %}link_next_pager{% endtrans %}</a></li>
                                     {% endif %}
                                 </ul>
                             </td>
@@ -104,7 +104,7 @@ file that was distributed with this source code.
                        $(this).closest('table').find("td input[type='checkbox']").attr('checked', $(this).is(':checked'));
                    });
                    $('.delete_link').click(function(e){
-                      if (!confirm('{% trans 'confirm_msg' from 'AdminBundle' %}')) e.preventDefault();
+                      if (!confirm('{% trans from 'AdminBundle' %}confirm_msg{% endtrans %}')) e.preventDefault();
                    });
                 });
             </script>
@@ -115,12 +115,12 @@ file that was distributed with this source code.
                         <option value="{{ action }}">{{ label }}</option>
                     {% endfor %}
                 </select>
-                <input type="submit" value="{% trans 'btn_batch' from 'AdminBundle' %}" />
+                <input type="submit" value="{% trans from 'AdminBundle' %}btn_batch{% endtrans %}" />
             </div>
         </form>
     {% else %}
         <p class="notice">
-          {% trans 'no_result' from 'AdminBundle' %}
+          {% trans from 'AdminBundle' %}no_result{% endtrans %}
         </p>
     {% endif %}
 {% endblock %}
@@ -134,9 +134,9 @@ file that was distributed with this source code.
                 </div>
             {% endfor %}
 
-            <input type="submit" value="{% trans 'btn_filter' from 'AdminBundle' %}" />
+            <input type="submit" value="{% trans from 'AdminBundle' %}btn_filter{% endtrans %}" />
 
-            <a href="{{ admin.generateUrl('list') }}">{% trans 'link_reset_filter' from 'AdminBundle' %}</a>
+            <a href="{{ admin.generateUrl('list') }}">{% trans from 'AdminBundle' %}link_reset_filter{% endtrans %}</a>
         </form>
     {% endif %}
 {% endblock %}

+ 1 - 2
Resources/views/CRUD/edit_orm_many_to_many.html.twig

@@ -24,13 +24,12 @@ file that was distributed with this source code.
                 class="sonata-ba-action">
                     <img
                         src="{{ asset('bundles/sonataadmin/famfamfam/add.png') }}"
-                        alt="{% trans 'btn_add' from 'AdminBundle' %}"
+                        alt="{% trans from 'AdminBundle' %}btn_add{% endtrans %}"
                     />
             </a>
         </span>
 
         <div style="display: none" id="field_dialog_{{ field_element.vars.id }}">
-
         </div>
     </div>
 

+ 2 - 2
Resources/views/CRUD/edit_orm_many_to_one.html.twig

@@ -47,7 +47,7 @@ file that was distributed with this source code.
                         onclick="start_field_dialog_form_list_{{ field_element.vars.id }}(event)"
                         class="sonata-ba-action">
                         <img src="{{ asset('bundles/sonataadmin/famfamfam/application_view_list.png') }}"
-                             alt="{% trans 'btn_add' from 'AdminBundle' %}"
+                             alt="{% trans from 'AdminBundle' %}btn_add{% endtrans %}"
                         />
                     </a>
                 {% endif %}
@@ -56,7 +56,7 @@ file that was distributed with this source code.
                     onclick="start_field_dialog_form_add_{{ field_element.vars.id }}(event)"
                     class="sonata-ba-action">
                         <img src="{{ asset('bundles/sonataadmin/famfamfam/add.png') }}"
-                            alt="{% trans 'btn_add' from 'AdminBundle' %}"
+                            alt="{% trans from 'AdminBundle' %}btn_add{% endtrans %}"
                         />
                 </a>
             </span>

+ 4 - 4
Resources/views/CRUD/edit_orm_one_to_many.html.twig

@@ -71,7 +71,7 @@ file that was distributed with this source code.
                     class="sonata-ba-action">
                     <img
                         src="{{ asset('bundles/sonataadmin/famfamfam/add.png') }}"
-                        alt="{% trans 'btn_add' from 'AdminBundle' %}"
+                        alt="{% trans from 'AdminBundle' %}btn_add{% endtrans %}"
                      />
                 </a>
             </span>
@@ -95,8 +95,8 @@ file that was distributed with this source code.
                             jQuery('input', element).hide();
                         });
 
-                        jQuery('div#field_container_{{ field_element.vars.id }} tbody.sonata-ba-tbody td.sonata-ba-td-{{ field_element.vars.id }}-position input').each(function(index, value) {
-                            //jQuery(value).val(index + 1);
+                        jQuery('div#field_container_{{ field_element.id }} tbody.sonata-ba-tbody td.sonata-ba-td-{{ field_element.id }}-position input').each(function(index, value) {
+                            jQuery(value).val(index + 1);
                         });
                     }
 
@@ -122,7 +122,7 @@ file that was distributed with this source code.
                     class="sonata-ba-action">
                     <img
                         src="{{ asset('bundles/sonataadmin/famfamfam/add.png') }}"
-                        alt="{% trans 'btn_add' from 'AdminBundle' %}"
+                        alt="{% trans from 'AdminBundle' %}btn_add{% endtrans %}"
                      />
                 </a>
             </span>

+ 2 - 2
Resources/views/CRUD/edit_orm_one_to_one.html.twig

@@ -47,7 +47,7 @@ file that was distributed with this source code.
                         class="sonata-ba-action">
                             <img
                                 src="{{ asset('bundles/sonataadmin/famfamfam/application_view_list.png') }}"
-                                alt="{% trans 'btn_add' from 'AdminBundle' %}"
+                                alt="{% trans from 'AdminBundle' %}btn_add{% endtrans %}"
                             />
                           </a>
                 {% endif %}
@@ -57,7 +57,7 @@ file that was distributed with this source code.
                     class="sonata-ba-action">
                         <img
                             src="{{ asset('bundles/sonataadmin/famfamfam/add.png') }}"
-                            alt="{% trans 'btn_add' from 'AdminBundle' %}"
+                            alt="{% trans from 'AdminBundle' %}btn_add{% endtrans %}"
                         />
                 </a>
             </span>

+ 2 - 2
Resources/views/CRUD/list__action_delete.html.twig

@@ -1,3 +1,3 @@
-<a href="{{ admin.generateUrl('delete', {'id': object.id}) }}" class="delete_link" title="{% trans 'action_delete' from 'AdminBundle' %}">
-    <img src="{{ asset('bundles/sonataadmin/famfamfam/delete.png') }}" alt="{% trans 'action_delete' from 'AdminBundle' %}" />
+<a href="{{ admin.generateUrl('delete', {'id': object.id}) }}" class="delete_link" title="{% trans from 'AdminBundle' %}action_delete{% endtrans %}">
+    <img src="{{ asset('bundles/sonataadmin/famfamfam/delete.png') }}" alt="{% trans from 'AdminBundle' %}action_delete{% endtrans %}" />
 </a>

+ 2 - 2
Resources/views/CRUD/list__action_edit.html.twig

@@ -1,3 +1,3 @@
-<a href="{{ admin.generateUrl('edit', {'id': object.id}) }}" class="edit_link" title="{% trans 'action_edit' from 'AdminBundle' %}">
-    <img src="{{ asset('bundles/sonataadmin/famfamfam/page_white_edit.png') }}" alt="{% trans 'action_edit' from 'AdminBundle' %}" />
+<a href="{{ admin.generateUrl('edit', {'id': object.id}) }}" class="edit_link" title="{% trans from 'AdminBundle' %}action_edit{% endtrans %}">
+    <img src="{{ asset('bundles/sonataadmin/famfamfam/page_white_edit.png') }}" alt="{% trans from 'AdminBundle' %}action_edit{% endtrans %}" />
 </a>

+ 2 - 2
Resources/views/CRUD/list__action_view.html.twig

@@ -1,3 +1,3 @@
-<a href="{{ admin.generateUrl('view', {'id': object.id}) }}" class="view_link" title="{% trans 'action_view' from 'AdminBundle' %}">
-    <img src="{{ asset('bundles/sonataadmin/famfamfam/magnifier.png') }}" alt="{% trans 'action_view' from 'AdminBundle' %}" />
+<a href="{{ admin.generateUrl('view', {'id': object.id}) }}" class="view_link" title="{% trans from 'AdminBundle' %}action_view{% endtrans %}">
+    <img src="{{ asset('bundles/sonataadmin/famfamfam/magnifier.png') }}" alt="{% trans from 'AdminBundle' %}action_view{% endtrans %}" />
 </a>

+ 6 - 6
Resources/views/Core/dashboard.html.twig

@@ -11,24 +11,24 @@ file that was distributed with this source code.
 
 {% extends base_template %}
 
-{% block title %}{% trans 'title_dashboard' from 'AdminBundle' %}{% endblock%}
-{% block breadcrumb %}{% trans 'title_dashboard' from 'AdminBundle' %}{% endblock %}
+{% block title %}{% trans from 'AdminBundle' %}title_dashboard{% endtrans %}{% endblock%}
+{% block breadcrumb %}{% trans from 'AdminBundle' %}title_dashboard{% endtrans %}{% endblock %}
 {% block content %}
 
     {% for code, group in groups %}
         <table class="sonata-ba-list">
             <thead>
                 <tr>
-                    <th  colspan="3">{% trans code from 'AdminBundle' %}</td>
+                    <th  colspan="3">{{ code|trans({}, 'AdminBundle') }}</td>
                 </tr>
             </thead>
 
             <tbody>
                 {% for admin in group %}
                     <tr>
-                        <td class="sonata-ba-list-label">{% trans admin.label from admin.translationdomain  %}</td>
-                        <td><a href="{{ admin.generateUrl('create')}}"><img src="{{ asset('bundles/sonataadmin/famfamfam/add.png') }}" /> {% trans 'link_add' from 'AdminBundle' %}</a></td>
-                        <td><a href="{{ admin.generateUrl('list')}}"><img src="{{ asset('bundles/sonataadmin/famfamfam/application_view_list.png') }}" />{% trans 'link_list' from 'AdminBundle' %}</a></td>
+                        <td class="sonata-ba-list-label">{{ admin.label|trans({}, admin.translationdomain) }}</td>
+                        <td><a href="{{ admin.generateUrl('create')}}"><img src="{{ asset('bundles/sonataadmin/famfamfam/add.png') }}" /> {% trans from 'AdminBundle' %}link_add{% endtrans %}</a></td>
+                        <td><a href="{{ admin.generateUrl('list')}}"><img src="{{ asset('bundles/sonataadmin/famfamfam/application_view_list.png') }}" />{% trans from 'AdminBundle' %}link_list{% endtrans %}</a></td>
                     </tr>
                 {% endfor %}
             </tbody>

+ 2 - 2
Resources/views/standard_layout.html.twig

@@ -37,7 +37,7 @@ file that was distributed with this source code.
         {% endblock %}
 
         <title>
-            {% block title %} {% trans 'Admin' from 'AdminBundle' %}
+            {% block title %} {% trans from 'AdminBundle' %}Admin{% endtrans %}
                 {% if action is defined %}
                     -
                     {% for label, uri in admin.breadcrumbs(action) %}
@@ -62,7 +62,7 @@ file that was distributed with this source code.
         <div class="container">
             <div class="span-24 last header">
                 <div class="span-20">
-                    <a href="{{ url('sonata_admin_dashboard') }}" class="home">{% trans 'Admin' from 'AdminBundle' %}</a>
+                    <a href="{{ url('sonata_admin_dashboard') }}" class="home">{% trans from 'AdminBundle' %}Admin{% endtrans %}</a>
                 </div>
 
                 <div class="span-4 last">