Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixed batch actions if size of actions = 0 #1171

Closed
wants to merge 4 commits into from

4 participants

Vladislav Vlastovskiy wiistriker Thomas Christophe Coevoet
Vladislav Vlastovskiy

If the batch not action, it does not mean that it is not necessary export and choose the number of items on the page.
For example, I do not need the mass removal, in which case the batchactions|length == 0

Translated missing labels (P.S. I native speaker)

vlastv added some commits
Vladislav Vlastovskiy vlastv Fixed batch actions if size of actions = 0
If the batch not action, it does not mean that it is not necessary export and choose the number of items on the page.
For example, I do not need the mass removal, in which case the batchactions|length == 0
27b5190
Vladislav Vlastovskiy vlastv Translated missing labels f682725
Resources/views/CRUD/base_list.html.twig
((10 lines not shown))
- {% elseif field_description.name == '_action' and app.request.isXmlHttpRequest %}
- {# Action buttons disabled in ajax view! #}
- {% else %}
- {% set sortable = false %}
- {% if field_description.options.sortable is defined and field_description.options.sortable%}
- {% set sortable = true %}
- {% set current = admin.datagrid.values._sort_by == field_description %}
- {% set sort_parameters = admin.modelmanager.sortparameters(field_description, admin.datagrid) %}
- {% set sort_active_class = current ? 'sonata-ba-list-field-order-active' : '' %}
- {% set sort_by = current ? admin.datagrid.values._sort_order : field_description.options._sort_order %}
- {% endif %}
-
- {% spaceless %}
- <th class="sonata-ba-list-field-header-{{ field_description.type}} {% if sortable %} sonata-ba-list-field-header-order-{{ sort_by|lower }} {{ sort_active_class }}{% endif %}">
- {% if sortable %}<a href="{{ admin.generateUrl('list', sort_parameters) }}">{% endif %}
+ <tr class="sonata-ba-list-field-header">
Christophe Coevoet
stof added a note

why changing the indentation ?

Vladislav Vlastovskiy
vlastv added a note

Sorry, this alignment of made JetBrains PhpStorm IDE.
I renew?

Christophe Coevoet
stof added a note

Please update the PR to revert the indentation change (you can add new commits in the PR by pushing to the branch used to create it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Resources/views/CRUD/base_list.html.twig
((58 lines not shown))
</thead>
{% endblock %}
{% block table_body %}
<tbody>
- {% for object in admin.datagrid.results %}
- <tr>
- {% for field_description in admin.list.elements %}
- {% if field_description.name == '_action' and app.request.isXmlHttpRequest %}
- {# Action buttons disabled in ajax view! #}
- {% else %}
- {{ object|render_list_element(field_description) }}
- {% endif %}
- {% endfor %}
- </tr>
- {% endfor %}
+ {% for object in admin.datagrid.results %}
Christophe Coevoet
stof added a note

same question here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
vlastv added some commits
Vladislav Vlastovskiy vlastv Reverted changes indent f238aa9
Vladislav Vlastovskiy vlastv Revert "Fixed batch actions if size of actions = 0"
This reverts commit 27b5190.

Conflicts:
	Resources/views/CRUD/base_list.html.twig
d9cc087
Thomas
Owner

already fixed and translation is also set

Thomas rande closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 13, 2013
  1. Vladislav Vlastovskiy

    Fixed batch actions if size of actions = 0

    vlastv authored
    If the batch not action, it does not mean that it is not necessary export and choose the number of items on the page.
    For example, I do not need the mass removal, in which case the batchactions|length == 0
  2. Vladislav Vlastovskiy

    Translated missing labels

    vlastv authored
Commits on Feb 14, 2013
  1. Vladislav Vlastovskiy

    Reverted changes indent

    vlastv authored
  2. Vladislav Vlastovskiy

    Revert "Fixed batch actions if size of actions = 0"

    vlastv authored
    This reverts commit 27b5190.
    
    Conflicts:
    	Resources/views/CRUD/base_list.html.twig
This page is out of date. Refresh to see the latest.
8 Resources/translations/SonataAdminBundle.ru.xliff
View
@@ -328,19 +328,19 @@
</trans-unit>
<trans-unit id="btn_preview">
<source>btn_preview</source>
- <target>btn_preview</target>
+ <target>Предпросмотр</target>
</trans-unit>
<trans-unit id="btn_preview_approve">
<source>btn_preview_approve</source>
- <target>btn_preview_approve</target>
+ <target>Утвердить</target>
</trans-unit>
<trans-unit id="btn_preview_decline">
<source>btn_preview_decline</source>
- <target>btn_preview_decline</target>
+ <target>Отклонить</target>
</trans-unit>
<trans-unit id="label_per_page">
<source>label_per_page</source>
- <target>label_per_page</target>
+ <target>На страницу</target>
</trans-unit>
</body>
</file>
114 Resources/views/CRUD/base_list.html.twig
View
@@ -30,10 +30,10 @@ file that was distributed with this source code.
{% for field_description in admin.list.elements %}
{% if field_description.getOption('code') == '_batch' and batchactions|length > 0%}
<th class="sonata-ba-list-field-header sonata-ba-list-field-header-batch">
- <input type="checkbox" id="list_batch_checkbox" />
+ <input type="checkbox" id="list_batch_checkbox" />
</th>
{% elseif field_description.name == '_action' and app.request.isXmlHttpRequest %}
- {# Action buttons disabled in ajax view! #}
+ {# Action buttons disabled in ajax view! #}
{% else %}
{% set sortable = false %}
{% if field_description.options.sortable is defined and field_description.options.sortable%}
@@ -63,10 +63,10 @@ file that was distributed with this source code.
<tr>
{% for field_description in admin.list.elements %}
{% if field_description.name == '_action' and app.request.isXmlHttpRequest %}
- {# Action buttons disabled in ajax view! #}
- {% else %}
- {{ object|render_list_element(field_description) }}
- {% endif %}
+ {# Action buttons disabled in ajax view! #}
+ {% else %}
+ {{ object|render_list_element(field_description) }}
+ {% endif %}
{% endfor %}
</tr>
{% endfor %}
@@ -77,64 +77,64 @@ file that was distributed with this source code.
<tr>
<th colspan="{{ admin.list.elements|length - (app.request.isXmlHttpRequest ? 2 : 0) }}">
<div class="form-inline">
- {% if not app.request.isXmlHttpRequest and batchactions|length > 0 %}
+ {% if not app.request.isXmlHttpRequest %}
{% block batch %}
- <script type="text/javascript">
- {% block batch_javascript %}
- jQuery(document).ready(function ($) {
- $('#list_batch_checkbox').click(function () {
- $(this).closest('table').find("td input[type='checkbox']").attr('checked', $(this).is(':checked')).parent().parent().toggleClass('sonata-ba-list-row-selected', $(this).is(':checked'));
- });
- $("td.sonata-ba-list-field-batch input[type='checkbox']").change(function () {
- $(this).parent().parent().toggleClass('sonata-ba-list-row-selected', $(this).is(':checked'));
- });
- });
- {% endblock %}
- </script>
-
- {% block batch_actions %}
- <label class="checkbox" for="{{ admin.uniqid }}_all_elements">
- <input type="checkbox" name="all_elements" id="{{ admin.uniqid }}_all_elements"/>
- {{ 'all_elements'|trans({}, 'SonataAdminBundle') }}
- </label>
+ {% if batchactions|length > 0 %}
+ {% block batch_actions %}
+ <script type="text/javascript">
+ {% block batch_javascript %}
+ jQuery(document).ready(function ($) {
+ $('#list_batch_checkbox').click(function () {
+ $(this).closest('table').find("td input[type='checkbox']").attr('checked', $(this).is(':checked')).parent().parent().toggleClass('sonata-ba-list-row-selected', $(this).is(':checked'));
+ });
+ $("td.sonata-ba-list-field-batch input[type='checkbox']").change(function () {
+ $(this).parent().parent().toggleClass('sonata-ba-list-row-selected', $(this).is(':checked'));
+ });
+ });
+ {% endblock %}
+ </script>
+
+ <label class="checkbox" for="{{ admin.uniqid }}_all_elements">
+ <input type="checkbox" name="all_elements" id="{{ admin.uniqid }}_all_elements"/>
+ {{ 'all_elements'|trans({}, 'SonataAdminBundle') }}
+ </label>
+
+ <select name="action" style="width: auto; height: auto">
+ {% for action, options in batchactions %}
+ <option value="{{ action }}">{{ options.label }}</option>
+ {% endfor %}
+ </select>
- <select name="action" style="width: auto; height: auto">
- {% for action, options in batchactions %}
- <option value="{{ action }}">{{ options.label }}</option>
+ <input type="submit" class="btn btn-small btn-primary" value="{{ 'btn_batch'|trans({}, 'SonataAdminBundle') }}"/>
+ {% endblock %}
+ {% endif %}
+ <div class="pull-right">
+ {% if admin.hasRoute('export') and admin.isGranted("EXPORT") and admin.getExportFormats()|length %}
+ {{ "label_export_download"|trans({}, "SonataAdminBundle") }}
+ {% for format in admin.getExportFormats() %}
+ <a
+ href="{{ admin.generateUrl('export', admin.modelmanager.paginationparameters(admin.datagrid, 0) + {'format' : format}) }}">{{ format }}</a>{% if not loop.last %},{% endif %}
{% endfor %}
- </select>
- <input type="submit" class="btn btn-small btn-primary" value="{{ 'btn_batch'|trans({}, 'SonataAdminBundle') }}"/>
- <div class="pull-right">
- {% if admin.hasRoute('export') and admin.isGranted("EXPORT") and admin.getExportFormats()|length %}
- {{ "label_export_download"|trans({}, "SonataAdminBundle") }}
- {% for format in admin.getExportFormats() %}
- <a
- href="{{ admin.generateUrl('export', admin.modelmanager.paginationparameters(admin.datagrid, 0) + {'format' : format}) }}">{{ format }}</a>{% if not loop.last %},{% endif %}
- {% endfor %}
+ &nbsp;-&nbsp;
+ {% endif %}
- &nbsp;-&nbsp;
- {% endif %}
+ {{ admin.datagrid.pager.page }} / {{ admin.datagrid.pager.lastpage }}
- {{ admin.datagrid.pager.page }} / {{ admin.datagrid.pager.lastpage }}
+ &nbsp;-&nbsp;
- &nbsp;-&nbsp;
+ {% transchoice admin.datagrid.pager.nbresults with {'%count%': admin.datagrid.pager.nbresults} from 'SonataAdminBundle' %}list_results_count{% endtranschoice %}
- {% transchoice admin.datagrid.pager.nbresults with {'%count%': admin.datagrid.pager.nbresults} from 'SonataAdminBundle' %}list_results_count{% endtranschoice %}
-
- {% if not app.request.isXmlHttpRequest %}
- &nbsp;-&nbsp;
- <label class="control-label" for="{{ admin.uniqid }}_per_page">{% trans from 'SonataAdminBundle' %}label_per_page{% endtrans %}</label>
- <select class="per-page small" id="{{ admin.uniqid }}_per_page" style="width: auto; height: auto">
- {% for per_page in admin.getperpageoptions %}
- <option {% if per_page == admin.datagrid.pager.maxperpage %}selected="selected"{% endif %} value="{{ admin.generateUrl('list', {'filter': admin.datagrid.values | merge({'_per_page': per_page})}) }}">
- {{ per_page }}
- </option>
- {% endfor %}
- </select>
- {% endif %}
- </div>
- {% endblock %}
+ &nbsp;-&nbsp;
+ <label class="control-label" for="{{ admin.uniqid }}_per_page">{% trans from 'SonataAdminBundle' %}label_per_page{% endtrans %}</label>
+ <select class="per-page small" id="{{ admin.uniqid }}_per_page" style="width: auto; height: auto">
+ {% for per_page in admin.getperpageoptions %}
+ <option {% if per_page == admin.datagrid.pager.maxperpage %}selected="selected"{% endif %} value="{{ admin.generateUrl('list', {'filter': admin.datagrid.values | merge({'_per_page': per_page})}) }}">
+ {{ per_page }}
+ </option>
+ {% endfor %}
+ </select>
+ </div>
{% endblock %}
{% endif %}
</div>
@@ -193,7 +193,7 @@ file that was distributed with this source code.
<div class="filter_container {{ admin.datagrid.hasActiveFilters ? 'active' : 'inactive' }}">
<table class="table table-bordered">
{% for filter in admin.datagrid.filters %}
- <tr id="filter_{{ filter.name }}_row" class="filter {{ filter.isActive ? 'active' : 'inactive' }}">
+ <tr id="filter_{{ filter.name }}_row" class="filter {{ filter.isActive ? 'active' : 'inactive' }}">
<td class="filter-title">{{ admin.trans(filter.label) }}</td>
<td class="filter-type">{{ form_widget(form.children[filter.formName].children['type']) }}</td>
<td class="filter-value">{{ form_widget(form.children[filter.formName].children['value']) }}</td>
Something went wrong with that request. Please try again.