news/plugins/admin/themes/grav/templates/partials/nav-quick-tray.html.twig

47 lines
2.2 KiB
Twig

{% set clear_cache_url = base_url_relative ~ '/cache.json/task' ~ config.system.param_sep ~ 'clearCache'|e('html_attr') %}
<ul id="admin-nav-quick-tray">
{% if authorize(['admin.maintenance', 'admin.super', 'admin.cache']) %}
<li class="hint--bottom" data-hint="{{ "PLUGIN_ADMIN.CLEAR_CACHE"|t }}">
<a data-clear-cache-type="" data-clear-cache="{{ uri.addNonce(clear_cache_url, 'admin-form', 'admin-nonce') }}">
<i class="fa fa-retweet"></i>
</a>
</li>
{% endif %}
{% if authorize(['admin.super']) and config.plugins.admin.whitelabel.quicktray_recompile %}
<li class="hint--bottom" data-hint="{{ "PLUGIN_ADMIN.QUICKTRAY_RECOMPILE_HELP"|t }}">
<a data-recompile-scss href="#">
<i class="fa fa-paint-brush"></i>
</a>
</li>
{% endif %}
{% if grav.twig.plugins_quick_tray %}
{% for label, item in grav.twig.plugins_quick_tray %}
{% if authorize((item.authorize is defined and item.authorize is iterable) ? item.authorize : [item.authorize ?: ('admin.' ~ (item.location ?: item.route)), 'admin.super']) %}
{% set data_tags = '' %}
{% if (item.data) %}
{% for key, value in item.data %}
{% set data_tags = data_tags ~ ' data-' ~ key ~ '="' ~ value ~ '"' %}
{% endfor %}
{% endif %}
<li class="{{ item.class }} hint--bottom" data-hint="{{ item.hint }}" {{ data_tags|raw }}>
{% if item.route %}
<a href="{{ url(item.route) }}" {% if item.target %}target="{{ item.target }}"{% endif %}>
<i class="fa fa-fw {{ item.icon }}"></i>
</a>
{% else %}
<i class="fa fa-fw {{ item.icon }}"></i>
{% endif %}
</li>
{% endif %}
{% endfor %}
{% else %}
{% if authorize(['admin.maintenance', 'admin.super']) %}
<li class="hint--bottom" data-hint="Add the 'quick-tray-links' plugin for more...">
<a href="{{ admin_route('/plugins/install') }}">
<i class="fa fa-plus"></i>
</a>
</li>
{% endif %}
{% endif %}
</ul>