nav-quick-tray.html.twig 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. {% set clear_cache_url = base_url_relative ~ '/cache.json/task' ~ config.system.param_sep ~ 'clearCache'|e('html_attr') %}
  2. <ul id="admin-nav-quick-tray">
  3. {% if authorize(['admin.maintenance', 'admin.super', 'admin.cache']) %}
  4. <li class="hint--bottom" data-hint="{{ "PLUGIN_ADMIN.CLEAR_CACHE"|t }}">
  5. <a data-clear-cache-type="" data-clear-cache="{{ uri.addNonce(clear_cache_url, 'admin-form', 'admin-nonce') }}">
  6. <i class="fa fa-retweet"></i>
  7. </a>
  8. </li>
  9. {% endif %}
  10. {% if authorize(['admin.super']) and config.plugins.admin.whitelabel.quicktray_recompile %}
  11. <li class="hint--bottom" data-hint="{{ "PLUGIN_ADMIN.QUICKTRAY_RECOMPILE_HELP"|t }}">
  12. <a data-recompile-scss href="#">
  13. <i class="fa fa-paint-brush"></i>
  14. </a>
  15. </li>
  16. {% endif %}
  17. {% if grav.twig.plugins_quick_tray %}
  18. {% for label, item in grav.twig.plugins_quick_tray %}
  19. {% if authorize((item.authorize is defined and item.authorize is iterable) ? item.authorize : [item.authorize ?: ('admin.' ~ (item.location ?: item.route)), 'admin.super']) %}
  20. {% set data_tags = '' %}
  21. {% if (item.data) %}
  22. {% for key, value in item.data %}
  23. {% set data_tags = data_tags ~ ' data-' ~ key ~ '="' ~ value ~ '"' %}
  24. {% endfor %}
  25. {% endif %}
  26. <li class="{{ item.class }} hint--bottom" data-hint="{{ item.hint }}" {{ data_tags|raw }}>
  27. {% if item.route %}
  28. <a href="{{ url(item.route) }}" {% if item.target %}target="{{ item.target }}"{% endif %}>
  29. <i class="fa fa-fw {{ item.icon }}"></i>
  30. </a>
  31. {% else %}
  32. <i class="fa fa-fw {{ item.icon }}"></i>
  33. {% endif %}
  34. </li>
  35. {% endif %}
  36. {% endfor %}
  37. {% else %}
  38. {% if authorize(['admin.maintenance', 'admin.super']) %}
  39. <li class="hint--bottom" data-hint="Add the 'quick-tray-links' plugin for more...">
  40. <a href="{{ admin_route('/plugins/install') }}">
  41. <i class="fa fa-plus"></i>
  42. </a>
  43. </li>
  44. {% endif %}
  45. {% endif %}
  46. </ul>