actions.html 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. {% import 'admin/static.html' as admin_static with context %}
  2. {% macro dropdown(actions, btn_class='btn dropdown-toggle') -%}
  3. <a class="{{ btn_class }}" data-toggle="dropdown" href="javascript:void(0)">{{ _gettext('With selected') }}<b class="caret"></b></a>
  4. <ul class="dropdown-menu">
  5. {% for p in actions %}
  6. <li>
  7. <a href="javascript:void(0)" onclick="return modelActions.execute('{{ p[0] }}');">{{ _gettext(p[1]) }}</a>
  8. </li>
  9. {% endfor %}
  10. </ul>
  11. {% endmacro %}
  12. {% macro form(actions, url) %}
  13. {% if actions %}
  14. <form id="action_form" action="{{ url }}" method="POST" style="display: none">
  15. {% if action_form.csrf_token %}
  16. {{ action_form.csrf_token }}
  17. {% elif csrf_token %}
  18. <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
  19. {% endif %}
  20. {{ action_form.url(value=return_url) }}
  21. {{ action_form.action() }}
  22. </form>
  23. {% endif %}
  24. {% endmacro %}
  25. {% macro script(message, actions, actions_confirmation) %}
  26. {% if actions %}
  27. <script src="{{ admin_static.url(filename='admin/js/actions.js', v='1.0.0') }}"></script>
  28. <script language="javascript">
  29. var modelActions = new AdminModelActions({{ message|tojson|safe }}, {{ actions_confirmation|tojson|safe }});
  30. </script>
  31. {% endif %}
  32. {% endmacro %}