tools.html.twig 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. {% extends 'partials/base.html.twig' %}
  2. {% set tools_slug = uri.basename %}
  3. {% if tools_slug == 'tools' %}{% set tools_slug = 'backups' %}{% endif %}
  4. {% set title = "PLUGIN_ADMIN.TOOLS"|t ~ ": " ~ ("PLUGIN_ADMIN." ~ tools_slug|underscorize|upper)|t %}
  5. {% set tools = admin.tools() %}
  6. {% set titlebar -%}
  7. {% include 'partials/tools-' ~ tools_slug ~ '-titlebar.html.twig' ignore missing %}
  8. {%- endset %}
  9. {% block titlebar %}
  10. {% if titlebar %}
  11. {{ titlebar }}
  12. {% else %}
  13. <div class="button-bar">
  14. <a class="button" href="{{ base_url }}"><i class="fa fa-reply"></i> {{ "PLUGIN_ADMIN.BACK"|t }}</a>
  15. </div>
  16. <h1><i class="fa fa-fw fa-briefcase"></i> {{ "PLUGIN_ADMIN.TOOLS"|t }} - {{ ("PLUGIN_ADMIN." ~ tools_slug|underscorize|upper)|t }}</h1>
  17. {% endif %}
  18. {% endblock %}
  19. {% block content_top %}
  20. {% if tools|length > 1 %}
  21. <div class="form-tabs">
  22. <div class="tabs-nav">
  23. {% for slug,tool in tools %}
  24. {% set perms = tool|first %}
  25. {% set name = tool|last %}
  26. {% if authorize(perms) %}
  27. <a href="{{ admin_route('/tools/' ~ slug|hyphenize) }}" {% if tools_slug == slug|hyphenize %}class="active"{% endif %}>
  28. {{ name|t|capitalize }}
  29. </a>
  30. {% endif %}
  31. {% endfor %}
  32. </div>
  33. </div>
  34. {% endif %}
  35. {% endblock %}
  36. {% block content %}
  37. {% set perms = tools[tools_slug]|first %}
  38. {% if authorize(perms) %}
  39. {% include 'partials/tools-' ~ tools_slug ~ '.html.twig' ignore missing %}
  40. {% else %}
  41. <h1>Unauthorized</h1>
  42. {% endif %}
  43. {% endblock %}