mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-02 03:16:11 +01:00
Admin nav shows only the items a user is authorized to access. Same thing the dashboard. Users with admin.maintenance can update
This commit is contained in:
@@ -2,19 +2,22 @@
|
||||
|
||||
{% block titlebar %}
|
||||
<div class="button-bar">
|
||||
<div class="button-group">
|
||||
<button data-clear-cache="{{ base_url_relative }}/cache.json/task{{ config.system.param_sep }}clearCache" class="button"><i class="fa fa-trash"></i> {{ "PLUGIN_ADMIN.CLEAR_CACHE"|tu }}</button>
|
||||
<button type="button" class="button dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="fa fa-caret-down"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a data-clear-cache="{{ base_url_relative }}/cache.json/task{{ config.system.param_sep }}clearCache/cleartype{{ config.system.param_sep }}all" href="#">{{ "PLUGIN_ADMIN.CLEAR_CACHE_ALL_CACHE"|tu }}</a></li>
|
||||
<li><a data-clear-cache="{{ base_url_relative }}/cache.json/task{{ config.system.param_sep }}clearCache/cleartype{{ config.system.param_sep }}assets-only" href="#">{{ "PLUGIN_ADMIN.CLEAR_CACHE_ASSETS_ONLY"|tu }}</a></li>
|
||||
<li><a data-clear-cache="{{ base_url_relative }}/cache.json/task{{ config.system.param_sep }}clearCache/cleartype{{ config.system.param_sep }}images-only" href="#">{{ "PLUGIN_ADMIN.CLEAR_CACHE_IMAGES_ONLY"|tu }}</a></li>
|
||||
<li><a data-clear-cache="{{ base_url_relative }}/cache.json/task{{ config.system.param_sep }}clearCache/cleartype{{ config.system.param_sep }}cache-only" href="#">{{ "PLUGIN_ADMIN.CLEAR_CACHE_CACHE_ONLY"|tu }}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<button data-gpm-checkupdates="" class="button"><i class="fa fa-refresh"></i> {{ "PLUGIN_ADMIN.CHECK_FOR_UPDATES"|tu }}</button>
|
||||
{% if authorize(['admin.maintenance', 'admin.super']) %}
|
||||
<div class="button-group">
|
||||
<button data-clear-cache="{{ base_url_relative }}/cache.json/task{{ config.system.param_sep }}clearCache" class="button"><i class="fa fa-trash"></i> {{ "PLUGIN_ADMIN.CLEAR_CACHE"|tu }}</button>
|
||||
<button type="button" class="button dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="fa fa-caret-down"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a data-clear-cache="{{ base_url_relative }}/cache.json/task{{ config.system.param_sep }}clearCache/cleartype{{ config.system.param_sep }}all" href="#">{{ "PLUGIN_ADMIN.CLEAR_CACHE_ALL_CACHE"|tu }}</a></li>
|
||||
<li><a data-clear-cache="{{ base_url_relative }}/cache.json/task{{ config.system.param_sep }}clearCache/cleartype{{ config.system.param_sep }}assets-only" href="#">{{ "PLUGIN_ADMIN.CLEAR_CACHE_ASSETS_ONLY"|tu }}</a></li>
|
||||
<li><a data-clear-cache="{{ base_url_relative }}/cache.json/task{{ config.system.param_sep }}clearCache/cleartype{{ config.system.param_sep }}images-only" href="#">{{ "PLUGIN_ADMIN.CLEAR_CACHE_IMAGES_ONLY"|tu }}</a></li>
|
||||
<li><a data-clear-cache="{{ base_url_relative }}/cache.json/task{{ config.system.param_sep }}clearCache/cleartype{{ config.system.param_sep }}cache-only" href="#">{{ "PLUGIN_ADMIN.CLEAR_CACHE_CACHE_ONLY"|tu }}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<button data-gpm-checkupdates="" class="button"><i class="fa fa-refresh"></i> {{ "PLUGIN_ADMIN.CHECK_FOR_UPDATES"|tu }}</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
<h1><i class="fa fa-fw fa-th"></i> {{ "PLUGIN_ADMIN.DASHBOARD"|tu }}</h1>
|
||||
{% endblock %}
|
||||
@@ -28,97 +31,101 @@
|
||||
{% set backup = admin.lastBackup() %}
|
||||
|
||||
<div id="admin-dashboard">
|
||||
<div id="updates" class="dashboard-item dashboard-left">
|
||||
<div class="tertiary-accent default-box-shadow">
|
||||
<h1>{{ "PLUGIN_ADMIN.MAINTENANCE"|tu }}</h1>
|
||||
<div class="admin-update-charts">
|
||||
<div class="updates-chart">
|
||||
<div class="chart-wrapper">
|
||||
<div class="ct-chart"></div>
|
||||
<span class="numeric hidden"><span>-</span><em>{{ "PLUGIN_ADMIN.UPDATED"|tu|lower }}</em></span>
|
||||
{% if authorize(['admin.maintenance', 'admin.super']) %}
|
||||
<div id="updates" class="dashboard-item dashboard-left">
|
||||
<div class="tertiary-accent default-box-shadow">
|
||||
<h1>{{ "PLUGIN_ADMIN.MAINTENANCE"|tu }}</h1>
|
||||
<div class="admin-update-charts">
|
||||
<div class="updates-chart">
|
||||
<div class="chart-wrapper">
|
||||
<div class="ct-chart"></div>
|
||||
<span class="numeric hidden"><span>-</span><em>{{ "PLUGIN_ADMIN.UPDATED"|tu|lower }}</em></span>
|
||||
</div>
|
||||
<p class="js__updates-available-description"> </p>
|
||||
</div>
|
||||
<p class="js__updates-available-description"> </p>
|
||||
</div>
|
||||
<div class="backups-chart">
|
||||
<div class="chart-wrapper">
|
||||
<div class="ct-chart"></div>
|
||||
<script>
|
||||
var data = {
|
||||
series: [{{ backup.chart_fill }}, {{ backup.chart_empty }}]
|
||||
};
|
||||
var options = {
|
||||
donut: true,
|
||||
donutWidth: 10,
|
||||
startAngle: 0,
|
||||
total: 100,
|
||||
showLabel: false,
|
||||
height: 150,
|
||||
chartPadding: !isFirefox ? 5 : 10
|
||||
};
|
||||
Chartist.Pie('.backups-chart .ct-chart', data, options);
|
||||
</script>
|
||||
<span class="numeric">{{ backup.days }}<em>{{ "PLUGIN_ADMIN.DAYS"|tu|lower }}</em></span>
|
||||
<div class="backups-chart">
|
||||
<div class="chart-wrapper">
|
||||
<div class="ct-chart"></div>
|
||||
<script>
|
||||
var data = {
|
||||
series: [{{ backup.chart_fill }}, {{ backup.chart_empty }}]
|
||||
};
|
||||
var options = {
|
||||
donut: true,
|
||||
donutWidth: 10,
|
||||
startAngle: 0,
|
||||
total: 100,
|
||||
showLabel: false,
|
||||
height: 150,
|
||||
chartPadding: !isFirefox ? 5 : 10
|
||||
};
|
||||
Chartist.Pie('.backups-chart .ct-chart', data, options);
|
||||
</script>
|
||||
<span class="numeric">{{ backup.days }}<em>{{ "PLUGIN_ADMIN.DAYS"|tu|lower }}</em></span>
|
||||
</div>
|
||||
<p>{{ "PLUGIN_ADMIN.LAST_BACKUP"|tu }}</p>
|
||||
</div>
|
||||
<p>{{ "PLUGIN_ADMIN.LAST_BACKUP"|tu }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flush-bottom button-bar">
|
||||
<button data-maintenance-update="{{ base_url_relative }}/update.json/task{{ config.system.param_sep }}update" class="button"><i class="fa fa-cloud-download"></i> {{ "PLUGIN_ADMIN.UPDATE"|tu }}</button>
|
||||
<button data-ajax="{{ base_url_relative }}/backup.json/task{{ config.system.param_sep }}backup" class="button"><i class="fa fa-database"></i> {{ "PLUGIN_ADMIN.BACKUP"|tu }}</button>
|
||||
<div class="flush-bottom button-bar">
|
||||
<button data-maintenance-update="{{ base_url_relative }}/update.json/task{{ config.system.param_sep }}update" class="button"><i class="fa fa-cloud-download"></i> {{ "PLUGIN_ADMIN.UPDATE"|tu }}</button>
|
||||
<button data-ajax="{{ base_url_relative }}/backup.json/task{{ config.system.param_sep }}backup" class="button"><i class="fa fa-database"></i> {{ "PLUGIN_ADMIN.BACKUP"|tu }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="popularity" class="dashboard-item dashboard-right">
|
||||
<div class="secondary-accent default-box-shadow">
|
||||
<h1>{{ "PLUGIN_ADMIN.STATISTICS"|tu }}</h1>
|
||||
<div class="ct-chart"></div>
|
||||
<script>
|
||||
var data = {
|
||||
labels: {{ popularity.getDailyChartData['labels'] }},
|
||||
series: [
|
||||
{{ popularity.getDailyChartData['data'] }}
|
||||
]
|
||||
};
|
||||
var options = {
|
||||
height: 164,
|
||||
chartPadding: !isFirefox ? 5 : 25,
|
||||
{% endif %}
|
||||
{% if authorize(['admin.statistics', 'admin.super']) %}
|
||||
<div id="popularity" class="dashboard-item dashboard-right">
|
||||
<div class="secondary-accent default-box-shadow">
|
||||
<h1>{{ "PLUGIN_ADMIN.STATISTICS"|tu }}</h1>
|
||||
<div class="ct-chart"></div>
|
||||
<script>
|
||||
var data = {
|
||||
labels: {{ popularity.getDailyChartData['labels'] }},
|
||||
series: [
|
||||
{{ popularity.getDailyChartData['data'] }}
|
||||
]
|
||||
};
|
||||
var options = {
|
||||
height: 164,
|
||||
chartPadding: !isFirefox ? 5 : 25,
|
||||
|
||||
axisX: {
|
||||
showGrid: false,
|
||||
labelOffset: {
|
||||
x: 0,
|
||||
y: 5
|
||||
}
|
||||
},
|
||||
axisY: {
|
||||
offset: 15,
|
||||
showLabel: true,
|
||||
showGrid: true,
|
||||
labelOffset: {
|
||||
x: 5,
|
||||
y: 5
|
||||
axisX: {
|
||||
showGrid: false,
|
||||
labelOffset: {
|
||||
x: 0,
|
||||
y: 5
|
||||
}
|
||||
},
|
||||
scaleMinSpace: 20
|
||||
}
|
||||
};
|
||||
Chartist.Bar('#popularity .ct-chart', data, options);
|
||||
</script>
|
||||
<div class="flush-bottom button-bar stats-bar">
|
||||
<span class="stat">
|
||||
<b>{{ popularity.getDailyTotal }}</b>
|
||||
<i>{{ "PLUGIN_ADMIN.TODAY"|tu }}</i>
|
||||
</span>
|
||||
<span class="stat">
|
||||
<b>{{ popularity.getWeeklyTotal }}</b>
|
||||
<i>{{ "PLUGIN_ADMIN.WEEK"|tu }}</i>
|
||||
</span>
|
||||
<span class="stat">
|
||||
<b>{{ popularity.getMonthlyTotal }}</b>
|
||||
<i>{{ "PLUGIN_ADMIN.MONTH"|tu }}</i>
|
||||
</span>
|
||||
axisY: {
|
||||
offset: 15,
|
||||
showLabel: true,
|
||||
showGrid: true,
|
||||
labelOffset: {
|
||||
x: 5,
|
||||
y: 5
|
||||
},
|
||||
scaleMinSpace: 20
|
||||
}
|
||||
};
|
||||
Chartist.Bar('#popularity .ct-chart', data, options);
|
||||
</script>
|
||||
<div class="flush-bottom button-bar stats-bar">
|
||||
<span class="stat">
|
||||
<b>{{ popularity.getDailyTotal }}</b>
|
||||
<i>{{ "PLUGIN_ADMIN.TODAY"|tu }}</i>
|
||||
</span>
|
||||
<span class="stat">
|
||||
<b>{{ popularity.getWeeklyTotal }}</b>
|
||||
<i>{{ "PLUGIN_ADMIN.WEEK"|tu }}</i>
|
||||
</span>
|
||||
<span class="stat">
|
||||
<b>{{ popularity.getMonthlyTotal }}</b>
|
||||
<i>{{ "PLUGIN_ADMIN.MONTH"|tu }}</i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -126,19 +133,19 @@
|
||||
|
||||
{% include 'partials/messages.html.twig' %}
|
||||
{% if config.plugins.admin.show_beta_msg %}
|
||||
<div class="error alert"><i class="fa fa-exclamation-circle"></i> {{ 'PLUGIN_ADMIN.ADMIN_BETA_MSG'|tu }}</div>
|
||||
<div class="error alert"><i class="fa fa-exclamation-circle"></i> {{ 'PLUGIN_ADMIN.ADMIN_BETA_MSG'|tu }}</div>
|
||||
{% endif %}
|
||||
<div id="latest">
|
||||
<div class="button-bar">
|
||||
<a class="button" href="{{ uri.route(true) }}/pages"><i class="fa fa-fw fa-file-text-o"></i>{{ "PLUGIN_ADMIN.MANAGE_PAGES"|tu }}</a>
|
||||
{% if authorize(['admin.pages', 'admin.super']) %}
|
||||
<div id="latest">
|
||||
<div class="button-bar">
|
||||
<a class="button" href="{{ uri.route(true) }}/pages"><i class="fa fa-fw fa-file-text-o"></i>{{ "PLUGIN_ADMIN.MANAGE_PAGES"|tu }}</a>
|
||||
</div>
|
||||
<h1>{{ "PLUGIN_ADMIN.LATEST_PAGE_UPDATES"|tu }}</h1>
|
||||
<table>
|
||||
{% for latest in admin.latestPages %}
|
||||
<tr><td class="double page-title"><a href="{{ base_url }}/pages/{{ latest.route|trim('/') }}"><i class="fa fa-fw fa-file-o"></i> {{ latest.title }}</a></td><td class="double page-route">{{ latest.route }}</td><td><b class="last-modified">{{ latest.modified|nicetime }}</b></td></tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
<h1>{{ "PLUGIN_ADMIN.LATEST_PAGE_UPDATES"|tu }}</h1>
|
||||
<table>
|
||||
{% for latest in admin.latestPages %}
|
||||
<tr><td class="double page-title"><a href="{{ base_url }}/pages/{{ latest.route|trim('/') }}"><i class="fa fa-fw fa-file-o"></i> {{ latest.title }}</a></td><td class="double page-route">{{ latest.route }}</td><td><b class="last-modified">{{ latest.modified|nicetime }}</b></td></tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
@@ -20,45 +20,55 @@
|
||||
<li class="{{ (location == 'dashboard') ? 'selected' : '' }}">
|
||||
<a href="{{ base_url_relative }}"><i class="fa fa-fw fa-th"></i> {{ "PLUGIN_ADMIN.DASHBOARD"|tu }}</a>
|
||||
</li>
|
||||
<li class="{{ (location == 'system' or location == 'site') ? 'selected' : '' }}">
|
||||
<a href="{{ base_url_relative }}/system"><i class="fa fa-fw fa-wrench"></i> {{ "PLUGIN_ADMIN.CONFIGURATION"|tu }}</a>
|
||||
</li>
|
||||
<li class="{{ (location == 'pages') ? 'selected' : '' }}">
|
||||
<a href="{{ base_url_relative }}/pages">
|
||||
<i class="fa fa-fw fa-file-text-o"></i> {{ "PLUGIN_ADMIN.PAGES"|tu }}
|
||||
<span class="badges">
|
||||
<span class="badge count">{{ admin.routes(true)|length }}</span>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
{% if authorize(['admin.configuration', 'admin.super']) %}
|
||||
<li class="{{ (location == 'system' or location == 'site') ? 'selected' : '' }}">
|
||||
<a href="{{ base_url_relative }}/system"><i class="fa fa-fw fa-wrench"></i> {{ "PLUGIN_ADMIN.CONFIGURATION"|tu }}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if authorize(['admin.pages', 'admin.super']) %}
|
||||
<li class="{{ (location == 'pages') ? 'selected' : '' }}">
|
||||
<a href="{{ base_url_relative }}/pages">
|
||||
<i class="fa fa-fw fa-file-text-o"></i> {{ "PLUGIN_ADMIN.PAGES"|tu }}
|
||||
<span class="badges">
|
||||
<span class="badge count">{{ admin.routes(true)|length }}</span>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if grav.twig.plugins_hooked_nav %}
|
||||
{% for label, item in grav.twig.plugins_hooked_nav %}
|
||||
<li class="{{ (location == item.route) ? 'selected' : '' }}">
|
||||
<a href="{{ base_url_relative }}/{{ item.route }}">
|
||||
<i class="fa fa-fw {{ item.icon }}"></i> {{ label|tu }}
|
||||
</a>
|
||||
</li>
|
||||
{% if authorize(['admin.' ~ item.route, 'admin.super']) %}
|
||||
<li class="{{ (location == item.route) ? 'selected' : '' }}">
|
||||
<a href="{{ base_url_relative }}/{{ item.route }}">
|
||||
<i class="fa fa-fw {{ item.icon }}"></i> {{ label|tu }}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<li class="{{ (location == 'plugins') ? 'selected' : '' }}">
|
||||
<a href="{{ base_url_relative }}/plugins">
|
||||
<i class="fa fa-fw fa-plug"></i> {{ "PLUGIN_ADMIN.PLUGINS"|tu }}
|
||||
<span class="badges">
|
||||
<span class="badge updates"></span>
|
||||
<span class="badge count">{{ admin.plugins|length }}</span>
|
||||
{% if authorize(['admin.plugins', 'admin.super']) %}
|
||||
<li class="{{ (location == 'plugins') ? 'selected' : '' }}">
|
||||
<a href="{{ base_url_relative }}/plugins">
|
||||
<i class="fa fa-fw fa-plug"></i> {{ "PLUGIN_ADMIN.PLUGINS"|tu }}
|
||||
<span class="badges">
|
||||
<span class="badge updates"></span>
|
||||
<span class="badge count">{{ admin.plugins|length }}</span>
|
||||
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="{{ (location == 'themes') ? 'selected' : '' }}">
|
||||
<a href="{{ base_url_relative }}/themes">
|
||||
<i class="fa fa-fw fa-tint"></i> {{ "PLUGIN_ADMIN.THEMES"|tu }}
|
||||
<span class="badges">
|
||||
<span class="badge updates"></span>
|
||||
<span class="badge count">{{ admin.themes|length }}</span>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if authorize(['admin.themes', 'admin.super']) %}
|
||||
<li class="{{ (location == 'themes') ? 'selected' : '' }}">
|
||||
<a href="{{ base_url_relative }}/themes">
|
||||
<i class="fa fa-fw fa-tint"></i> {{ "PLUGIN_ADMIN.THEMES"|tu }}
|
||||
<span class="badges">
|
||||
<span class="badge updates"></span>
|
||||
<span class="badge count">{{ admin.themes|length }}</span>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% include 'nav-pro.html.twig' ignore missing %}
|
||||
|
||||
|
||||
@@ -23,7 +23,9 @@
|
||||
{% else %}
|
||||
<a class="button" href="{{ base_url }}"><i class="fa fa-reply"></i> {{ "PLUGIN_ADMIN.BACK"|tu }}</a>
|
||||
<a class="button" href="{{ base_url_relative }}/plugins/install"><i class="fa fa-plus"></i> {{ "PLUGIN_ADMIN.ADD"|tu }}</a>
|
||||
<button data-gpm-checkupdates="" class="button"><i class="fa fa-refresh"></i> {{ "PLUGIN_ADMIN.CHECK_FOR_UPDATES"|tu }}</button>
|
||||
{% if authorize(['admin.maintenance', 'admin.super']) %}
|
||||
<button data-gpm-checkupdates="" class="button"><i class="fa fa-refresh"></i> {{ "PLUGIN_ADMIN.CHECK_FOR_UPDATES"|tu }}</button>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<h1><i class="fa fa-fw fa-plug"></i> {{ "PLUGIN_ADMIN.PLUGINS"|tu }}</h1>
|
||||
@@ -57,4 +59,3 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
@@ -24,7 +24,9 @@
|
||||
{% else %}
|
||||
<a class="button" href="{{ base_url }}/"><i class="fa fa-reply"></i> {{ "PLUGIN_ADMIN.BACK"|tu }}</a>
|
||||
<a class="button" href="{{ base_url_relative }}/themes/install"><i class="fa fa-plus"></i> {{ "PLUGIN_ADMIN.ADD"|tu }}</a>
|
||||
<button data-gpm-checkupdates="" class="button"><i class="fa fa-refresh"></i> {{ "PLUGIN_ADMIN.CHECK_FOR_UPDATES"|tu }}</button>
|
||||
{% if authorize(['admin.maintenance', 'admin.super']) %}
|
||||
<button data-gpm-checkupdates="" class="button"><i class="fa fa-refresh"></i> {{ "PLUGIN_ADMIN.CHECK_FOR_UPDATES"|tu }}</button>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<h1><i class="fa fa-fw fa-plug"></i> {{ "PLUGIN_ADMIN.THEMES"|tu }}</h1>
|
||||
@@ -56,6 +58,3 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user