|
@@ -24,13 +24,14 @@ file that was distributed with this source code.
|
|
|
{% block side_menu %}{{ admin.sidemenu(action).render|raw }}{% endblock %}
|
|
|
|
|
|
{% block list_table %}
|
|
|
+ {% set batchactions = admin.batchactions %}
|
|
|
{% if admin.datagrid.results|length > 0 %}
|
|
|
<form action="{{ admin.generateUrl('batch') }}" method="POST" >
|
|
|
<table>
|
|
|
{% block table_header %}
|
|
|
<tr class="sonata-ba-list-field-header">
|
|
|
{% for field_description in admin.list.elements %}
|
|
|
- {% if field_description.getOption('code') == '_batch' %}
|
|
|
+ {% 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" />
|
|
|
</th>
|
|
@@ -100,25 +101,27 @@ file that was distributed with this source code.
|
|
|
{% endblock %}
|
|
|
</table>
|
|
|
|
|
|
- <script type="text/javascript">
|
|
|
- jQuery(document).ready(function($){
|
|
|
- $('#list_batch_checkbox').click(function(){
|
|
|
- $(this).closest('table').find("td input[type='checkbox']").attr('checked', $(this).is(':checked'));
|
|
|
- });
|
|
|
- $('.delete_link').click(function(e){
|
|
|
- if (!confirm('{% trans from 'SonataAdminBundle' %}confirm_msg{% endtrans %}')) e.preventDefault();
|
|
|
- });
|
|
|
- });
|
|
|
- </script>
|
|
|
-
|
|
|
- <div class="sonata-ba-list-actions">
|
|
|
- <select name="action">
|
|
|
- {% for action, label in admin.batchactions %}
|
|
|
- <option value="{{ action }}">{{ label }}</option>
|
|
|
- {% endfor %}
|
|
|
- </select>
|
|
|
- <input type="submit" value="{% trans from 'SonataAdminBundle' %}btn_batch{% endtrans %}" />
|
|
|
- </div>
|
|
|
+ {% if batchactions|length > 0%}
|
|
|
+ <script type="text/javascript">
|
|
|
+ jQuery(document).ready(function($){
|
|
|
+ $('#list_batch_checkbox').click(function(){
|
|
|
+ $(this).closest('table').find("td input[type='checkbox']").attr('checked', $(this).is(':checked'));
|
|
|
+ });
|
|
|
+ $('.delete_link').click(function(e){
|
|
|
+ if (!confirm('{% trans from 'SonataAdminBundle' %}confirm_msg{% endtrans %}')) e.preventDefault();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ </script>
|
|
|
+
|
|
|
+ <div class="sonata-ba-list-actions">
|
|
|
+ <select name="action">
|
|
|
+ {% for action, label in batchactions %}
|
|
|
+ <option value="{{ action }}">{{ label }}</option>
|
|
|
+ {% endfor %}
|
|
|
+ </select>
|
|
|
+ <input type="submit" value="{% trans from 'SonataAdminBundle' %}btn_batch{% endtrans %}" />
|
|
|
+ </div>
|
|
|
+ {% endif %}
|
|
|
</form>
|
|
|
{% else %}
|
|
|
<p class="notice">
|