added delete

This commit is contained in:
Andy Miller
2018-09-11 17:11:52 -06:00
parent d493194c4d
commit c517ec19a0
3 changed files with 6 additions and 3 deletions

View File

@@ -1391,7 +1391,7 @@ class AdminController extends AdminBaseController
*
* @return bool
*/
protected function taskDeleteBackup()
protected function taskBackupDelete()
{
$param_sep = $this->grav['config']->get('system.param_sep', ':');
if (!$this->authorizeTask('backup', ['admin.maintenance', 'admin.super'])) {

View File

@@ -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">
<thead>
<tr>
@@ -10,6 +11,8 @@
</thead>
<tbody>
{% for backup in backups %}
{% set encoded_name = backup.filename|base64_encode|url_encode %}
{% set backup_delete = delete_url|replace({'%BACKUP_FILE': encoded_name}) %}
<tr>
<td>{{ loop.index }}</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">
<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>
</tr>
{% endfor %}

View File

@@ -2,7 +2,7 @@
{% 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') %}
{% 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 }}
</button>
<button type="button" class="button dropdown-toggle" data-toggle="dropdown">