mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-03 11:55:52 +01:00
added delete
This commit is contained in:
@@ -1391,7 +1391,7 @@ class AdminController extends AdminBaseController
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
protected function taskDeleteBackup()
|
protected function taskBackupDelete()
|
||||||
{
|
{
|
||||||
$param_sep = $this->grav['config']->get('system.param_sep', ':');
|
$param_sep = $this->grav['config']->get('system.param_sep', ':');
|
||||||
if (!$this->authorizeTask('backup', ['admin.maintenance', 'admin.super'])) {
|
if (!$this->authorizeTask('backup', ['admin.maintenance', 'admin.super'])) {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
{% set delete_url = uri.addNonce(base_url_relative ~ "/backup.json/backup:%BACKUP_FILE/task" ~ config.system.param_sep ~ 'backupDelete', 'admin-form', 'admin-nonce') %}
|
||||||
<table class="backups-history noflex">
|
<table class="backups-history noflex">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -10,6 +11,8 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for backup in backups %}
|
{% for backup in backups %}
|
||||||
|
{% set encoded_name = backup.filename|base64_encode|url_encode %}
|
||||||
|
{% set backup_delete = delete_url|replace({'%BACKUP_FILE': encoded_name}) %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ loop.index }}</td>
|
<td>{{ loop.index }}</td>
|
||||||
<td style="white-space: nowrap;"> <i class="fa fa-clock-o"></i> {{ backup.date }}</td>
|
<td style="white-space: nowrap;"> <i class="fa fa-clock-o"></i> {{ backup.date }}</td>
|
||||||
@@ -17,7 +20,7 @@
|
|||||||
<td class="right pad">{{ backup.size|nicefilesize }}</td>
|
<td class="right pad">{{ backup.size|nicefilesize }}</td>
|
||||||
<td class="right pad">
|
<td class="right pad">
|
||||||
<a class="button button-small hint--bottom" href="{{ grav.backups.getBackupDownloadUrl(backup.path, admin.base) }}" data-hint="Download"><i class="fa fa-download"></i></a>
|
<a class="button button-small hint--bottom" href="{{ grav.backups.getBackupDownloadUrl(backup.path, admin.base) }}" data-hint="Download"><i class="fa fa-download"></i></a>
|
||||||
<a class="button button-small danger hint--bottom" data-hint="Delete"><i class="fa fa-close"></i></a>
|
<span class="button button-small danger hint--bottom" data-hint="Delete" data-ajax="{{ backup_delete }}"><i class="fa fa-close"></i></span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
{% set profiles = grav.backups.getBackupProfiles() %}
|
{% set profiles = grav.backups.getBackupProfiles() %}
|
||||||
{% set backup_url = uri.addNonce(base_url_relative ~ "/backup.json/id:%BACKUP_ID/task" ~ config.system.param_sep ~ 'backup', 'admin-form', 'admin-nonce') %}
|
{% set backup_url = uri.addNonce(base_url_relative ~ "/backup.json/id:%BACKUP_ID/task" ~ config.system.param_sep ~ 'backup', 'admin-form', 'admin-nonce') %}
|
||||||
{% if profiles|length > 1 %}
|
{% if profiles|length > 1 %}
|
||||||
<button class="button" href="#modal" data-remodal-target="modal" data-ajax="{{ backup_url|replace({'%BACKUP_ID':'0'}) }}">
|
<button class="button" data-ajax="{{ backup_url|replace({'%BACKUP_ID':'0'}) }}">
|
||||||
<i class="fa fa-life-ring"></i> {{ "PLUGIN_ADMIN.BACKUP_NOW"|tu }}
|
<i class="fa fa-life-ring"></i> {{ "PLUGIN_ADMIN.BACKUP_NOW"|tu }}
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="button dropdown-toggle" data-toggle="dropdown">
|
<button type="button" class="button dropdown-toggle" data-toggle="dropdown">
|
||||||
|
|||||||
Reference in New Issue
Block a user