tools.html.twig 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. {% extends 'partials/base.html.twig' %}
  2. {% set tools_slug = uri.basename|e %}
  3. {% if tools_slug == 'tools' %}{% set tools_slug = 'backups' %}{% endif %}
  4. {% set title = "PLUGIN_ADMIN.TOOLS"|tu ~ ": " ~ ("PLUGIN_ADMIN." ~ tools_slug|underscorize|upper)|tu %}
  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"|tu }}</a>
  15. </div>
  16. <h1><i class="fa fa-fw fa-briefcase"></i> {{ "PLUGIN_ADMIN.TOOLS"|tu }} - {{ ("PLUGIN_ADMIN." ~ tools_slug|underscorize|upper)|tu }}</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="{{ base_url_relative }}/tools/{{slug|hyphenize}}" {% if tools_slug == slug|hyphenize %}class="active"{% endif %}>
  28. {{ name|tu|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 %}