Advertisement
r1pp3rj4ck

AcmeDemoBundle::base_list.html.twig

May 11th, 2012
461
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.44 KB | None | 0 0
  1.     <script type="text/javascript">
  2.         jQuery(document).ready(function ($) {
  3.             $('#list_batch_checkbox').click(function () {
  4.                 $(this).closest('table').find("td input[type='checkbox']").attr('checked', $(this).is(':checked'));
  5.             });
  6.             $('.delete_link').click(function (e) {
  7.                 if (!confirm('{% trans from 'SonataAdminBundle' %}confirm_msg{% endtrans %}')) e.preventDefault();
  8.             });
  9.         });
  10.         var secondary_action = {};
  11.     </script>
  12.  
  13.     <div class="actions sonata-ba-list-actions">
  14.         <select id="primary" name="action">
  15.             {% for action, options in batchactions %}
  16.             <option id="{{ 'action-' ~ action }}" value="{{ action }}">{{ options.label }}</option>
  17.  
  18.             <script type="text/javascript">
  19.                 $(document).ready(function () {
  20.                     {% if options.secondary is defined %}
  21.                     secondary_action['{{ action }}'] = '{% for key, value in options.secondary %}<option value="{{ key }}">{{ value }}</option>{% endfor %}';
  22.                     {% else %}
  23.                     secondary_action['{{ action }}'] = '';
  24.                     {% endif %}
  25.                 });
  26.             </script>
  27.  
  28.             {% endfor %}
  29.         </select>
  30.  
  31.         <script type="text/javascript">
  32.             $(document).ready(function () {
  33.                 function fillSecondary() {
  34.                     var html = secondary_action[$('#primary').val()];
  35.                     $('#secondary').html(html);
  36.                     if (html != '') {
  37.                         $('#secondary-container').css('display', 'block');
  38.                     } else {
  39.                         $('#secondary-container').css('display', 'none');
  40.                     }
  41.                     return true;
  42.                 }
  43.  
  44.                 fillSecondary();
  45.  
  46.                 $('#primary').change(function () {
  47.                     fillSecondary();
  48.                 });
  49.             });
  50.         </script>
  51.  
  52.         <div id="secondary-container" style="display: none;">
  53.             <select name="secondary" id="secondary">
  54.             </select>
  55.         </div>
  56.  
  57.         <label>
  58.             <input type="checkbox" name="all_elements"/>
  59.             {% trans from 'SonataAdminBundle' %}all_elements{% endtrans %}
  60.         </label>
  61.  
  62.         <input type="submit" class="btn primary" value="{% trans from 'SonataAdminBundle' %}btn_batch{% endtrans %}"/>
  63.     </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement