44 lines
2.1 KiB
Twig
44 lines
2.1 KiB
Twig
|
{% if user.authorized and authorize(['admin.login', 'admin.super']) %}
|
||
|
{% set notifications = (config.plugins.admin.widgets['dashboard-notifications'] or config.plugins.admin.notifications.dashboard or config.plugins.admin.notifications.plugins or config.plugins.admin.notifications.themes) ? 1 : 0 %}
|
||
|
{% switch template_route %}
|
||
|
{% case 'dashboard' %}
|
||
|
{% set notifications_filters = "['feed', 'dashboard', 'top']" %}
|
||
|
{% case 'plugins' %}
|
||
|
{% set notifications_filters = "['plugins', 'top']" %}
|
||
|
{% case 'themes' %}
|
||
|
{% set notifications_filters = "['themes', 'top']" %}
|
||
|
{% default %}
|
||
|
{% set notifications_filters = "['top']" %}
|
||
|
{% endswitch %}
|
||
|
<script type="text/javascript">
|
||
|
window.GravAdmin = window.GravAdmin || {};
|
||
|
window.GravAdmin.config = {
|
||
|
current_url: '{{ uri.getCurrentRoute().withLanguage(grav.language.active).withExtension('').withoutParams().toString(true) }}',
|
||
|
base_url_relative: '{{ base_url_relative }}',
|
||
|
base_url_simple: '{{ base_url_simple }}',
|
||
|
route: '{{ admin.route|trim('/') }}',
|
||
|
param_sep: '{{ config.system.param_sep }}',
|
||
|
{% if authorize(['admin.maintenance', 'admin.super']) %}
|
||
|
enable_auto_updates_check: '{{ config.plugins.admin.enable_auto_updates_check }}',
|
||
|
{% endif %}
|
||
|
admin_timeout: '{{ config.plugins.admin.session.timeout ?: 1800 }}',
|
||
|
admin_nonce: '{{ admin.getNonce }}',
|
||
|
language: '{{ grav.user.language|default('en') }}',
|
||
|
pro_enabled: '{{ config.plugins["admin-pro"].enabled }}',
|
||
|
notifications: {
|
||
|
enabled: {{ notifications }},
|
||
|
filters: {{ notifications_filters|raw }}
|
||
|
},
|
||
|
local_notifications: '{{ config.system.local_notifications|default(false) }}',
|
||
|
site: {
|
||
|
delimiter: '{{ config.site.summary.delimiter|default('===') }}'
|
||
|
}
|
||
|
};
|
||
|
window.GravAdmin.uri_params = {};
|
||
|
|
||
|
{% for param, value in grav.uri.params(null, true) %}
|
||
|
window.GravAdmin.uri_params[{{ param|json_encode|raw }}] = "{{value|replace({'\\': '/'})}}";
|
||
|
{% endfor %}
|
||
|
</script>
|
||
|
{% endif %}
|