@@ -18,7 +18,7 @@ file that was distributed with this source code.
1818{% block side_menu %}{{ knp_menu_render(admin.sidemenu (action ), {' currentClass' : ' active' }, ' list' ) }}{% endblock %}
1919
2020{% block list_filters %}
21- {% if admin .datagrid .filters and not app . request . isxmlhttprequest %}
21+ {% if admin .datagrid .filters %}
2222
2323 <form action =" {{ admin.generateUrl (' list' ) }}" method =" GET"
2424 class =" sonata-filter-form {{ admin .isChild and 1 == admin .datagrid .filters | length ? ' hide' : ' ' }}form-horizontal filters" >
@@ -118,10 +118,17 @@ file that was distributed with this source code.
118118 <thead >
119119 <tr >
120120 {% for field_description in admin .list .elements %}
121- {% if field_description.getOption (' code' ) == ' _batch' and batchactions | length > 0 %}
122- <th class =" sonata-ba-list-field-header sonata-ba-list-field-header-batch" >
123- {# <input type="checkbox" id="list_batch_checkbox"/>#}
124- </th >
121+ {% if admin.hasRoute (' batch' ) and field_description.getOption (' code' ) == ' _batch' and batchactions | length > 0 %}
122+ {% if not app .request .isXmlHttpRequest %}
123+ <th class =" sonata-ba-list-field-header sonata-ba-list-field-header-batch" >
124+ </th >
125+ {% endif %}
126+ {% elseif field_description.getOption (' code' ) == ' _select' %}
127+ <th class =" sonata-ba-list-field-header sonata-ba-list-field-header-select" ></th >
128+ {% elseif field_description .name == ' _action' and app .request .isXmlHttpRequest %}
129+ {# Action buttons disabled in ajax view! #}
130+ {% elseif field_description.getOption (' ajax_hidden' ) == true and app .request .isXmlHttpRequest %}
131+ {# Disable fields with 'ajax_hidden' option set to true #}
125132 {% else %}
126133 {% set sortable = false %}
127134 {% if field_description .options .sortable is defined and field_description .options .sortable %}
@@ -150,12 +157,10 @@ file that was distributed with this source code.
150157 <tbody >
151158 {% for object in admin .datagrid .results %}
152159 <tr >
153- {% for field_description in admin .list .elements %}
154- {{ object | render_list_element(field_description ) }}
155- {% endfor %}
160+ {% include admin.getTemplate (' inner_list_row' ) %}
156161 </tr >
157162 {% endfor %}
158- {% if batchactions | length > 0 %}
163+ {% if batchactions | length > 0 and not app . request . isxmlhttprequest %}
159164 <tr >
160165 <td >
161166 <input type =" checkbox" id =" list_batch_checkbox" name =" all_elements" />
@@ -171,28 +176,28 @@ file that was distributed with this source code.
171176 {% block table_footer %}
172177 <tfoot >
173178 <tr >
174- <th colspan =" {{ admin .list .elements | length - 2 }}" >
175- {{ block ( ' batch ' ) }}
176- </ th >
177-
178- < th class =" align-right form-inline " colspan = " 2 " >
179- < label class = " control-label " >< strong >{% transchoice datagrid . pager . nbresults with { ' %count% ' : datagrid . pager . nbresults } from ' SonataAdminBundle ' %}
180- list_results_count {% endtranschoice %}</ strong ></ label >
181- {% block max_per_page %}
182- < label class = " control-label "
183- for = " {{ admin . uniqid }}_per_page " >{% trans from ' SonataAdminBundle ' %}
184- label_per_page{% endtrans %}
185- < select class = " per-page small " id = " {{ admin . uniqid }}_per_page "
186- style = " width: auto; height: auto " >
187- {% for per_page in admin . getperpageoptions %}
188- < option {% if per_page ==datagrid. pager . maxperpage %} selected = " selected " {% endif %}
189- value = " {{ admin. generateUrl ( ' list ' , { ' filter ' : datagrid . values | merge ({ ' _per_page ' : per_page })}) }}" >
190- {{ per_page }}
191- </ option >
192- {% endfor %}
193- </ select >
194- </label >
195- {% endblock %}
179+ <th colspan =" {{ admin .list .elements | length - ( app . request . isXmlHttpRequest ? ( admin . list . has ( ' _action ' ) + admin . list . has ( ' batch ' )) : 0 ) }}" >
180+ < div class = " form-inline " >
181+ {% if not app . request . isxmlhttprequest %}{{ block ( ' batch ' ) }}{% endif %}
182+ < div class = " pull-right " >
183+ < label class =" control-label " >< strong >{% transchoice datagrid . pager . nbresults with { ' %count% ' : datagrid . pager . nbresults } from ' SonataAdminBundle ' %}
184+ list_results_count{% endtranschoice %}</ strong ></ label >
185+ {% block max_per_page %}
186+ < label class = " control-label "
187+ for = " {{ admin . uniqid }}_per_page " >{% trans from ' SonataAdminBundle ' %}
188+ label_per_page{% endtrans %}</ label >
189+ < select class = " per-page small " id = " {{ admin . uniqid }}_per_page "
190+ style = " width: auto; height: auto " >
191+ {% for per_page in admin . getperpageoptions %}
192+ < option {% if per_page ==datagrid. pager . maxperpage %} selected = " selected " {% endif %}
193+ value = " {{ admin. generateUrl ( ' list ' , { ' filter ' : datagrid . values | merge ({ ' _per_page ' : per_page })}) }} " >
194+ {{ per_page }}
195+ </ option >
196+ {% endfor %}
197+ </ select >
198+ {% endblock %}
199+ </div >
200+ </ div >
196201 </th >
197202 </tr >
198203 </tfoot >
@@ -252,14 +257,16 @@ file that was distributed with this source code.
252257
253258 </div >
254259 {% endif %}
255- {% if admin.isGranted (" EXPORT" ) and admin.getExportFormats ()| length %}
256- <p > {{ " label_export_download" | trans({}, " NetworkingInitCmsBundle" ) }}:
257- {% for format in admin.getExportFormats () %}
258- <a
259- href =" {{ admin.generateUrl (' export' , admin .modelmanager .paginationparameters (admin .datagrid , 0 ) + {' format' : format }) }}"
260- class =" link-underlined" >{{ format }}</a >{% if not loop .last %},{% endif %}
261- {% endfor %}
262- </p >
260+ {% if not app .request .isxmlhttprequest %}
261+ {% if admin.isGranted (" EXPORT" ) and admin.getExportFormats ()| length %}
262+ <p > {{ " label_export_download" | trans({}, " NetworkingInitCmsBundle" ) }}:
263+ {% for format in admin.getExportFormats () %}
264+ <a
265+ href =" {{ admin.generateUrl (' export' , admin .modelmanager .paginationparameters (admin .datagrid , 0 ) + {' format' : format }) }}"
266+ class =" link-underlined" >{{ format }}</a >{% if not loop .last %},{% endif %}
267+ {% endfor %}
268+ </p >
269+ {% endif %}
263270 {% endif %}
264271
265272 {% if admin.hasRoute (' batch' ) %}
@@ -271,8 +278,14 @@ file that was distributed with this source code.
271278 </p >
272279 {% endif %}
273280
274- {% if not app .request .isxmlhttprequest %}
281+ {% if not app .request .isXmlHttpRequest %}
275282 </div >
283+ {% else %}
284+ <script type =" text/javascript" >
285+ $ (function () {
286+ Admin .add_filters ();
287+ });
288+ </script >
276289 {% endif %}
277290{% endblock %}
278291
0 commit comments