Skip to content

Commit

Permalink
Fixed hardcoded separators for backup and media picker (fixes #1602 , f…
Browse files Browse the repository at this point in the history
…ixes #1502)
  • Loading branch information
w00fz committed Feb 5, 2019
1 parent b8b8835 commit bfb0b8e
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions themes/grav/app/dashboard/backup.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { translations } from 'grav-config';
import request from '../utils/request';
import { Instances as Charts } from './chart';

$('[data-ajax*="task:backup/"]').on('click', function() {
$('[data-backup][data-ajax*="backup/"]').on('click', function() {
let element = $(this);
let url = element.data('ajax');
const inDropdown = element.closest('.dropdown-menu');
Expand All @@ -26,7 +26,7 @@ $('[data-ajax*="task:backup/"]').on('click', function() {
});
});

$('[data-ajax*="task:backupDelete"]').on('click', function() {
$('[data-backup][data-ajax*="backupDelete"]').on('click', function() {
let element = $(this);
let url = element.data('ajax');
const tr = element.closest('tr');
Expand Down
10 changes: 5 additions & 5 deletions themes/grav/app/media/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,24 @@ if ($('.thumbs-list-container .dropzone')[0]) {
$('.dropzone')[0].dropzone.files.forEach(function(file) { file.previewElement.remove(); });
$('.dropzone').first().removeClass('dz-started');

request(config.base_url_relative + '/media-manager.json/task:clearMediaCache', { method: 'post', body }, () => {
request(`${config.base_url_relative}/media-manager.json/task${config.param_sep}clearMediaCache`, { method: 'post', body }, () => {
filterFiles();
});
});
}

/* handle loading media */
var loadMedia = function loadMedia(filters, callback) {
var url = config.base_url_relative + '/media.json/tmpl:media-list-content/index:' + global_index;
var url = `${config.base_url_relative}/media.json/tmpl${config.param_sep}media-list-content/index${config.param_sep}${global_index}`;

if (filters.page) {
url += '/page:' + (filters.page).split('/').join('%5C');
url += `/page${config.param_sep}${(filters.page).split('/').join('%5C')}`;
}
if (filters.type && filters.type !== '*') {
url += '/type:' + filters.type;
url += `/type${config.param_sep}${filters.type}`;
}
if (filters.date && filters.date !== '*') {
url += '/date:' + filters.date;
url += `/date${config.param_sep}${filters.date}`;
}

if (!isLoading) {
Expand Down
12 changes: 6 additions & 6 deletions themes/grav/js/admin.min.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions themes/grav/js/vendor.min.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<td class="right pad">{{ backup.size|nicefilesize }}</td>
<td class="right pad nowrap" >
<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>
<span class="button button-small danger hint--bottom" data-hint="Delete" data-ajax="{{ backup_delete }}"><i class="fa fa-close"></i></span>
<span class="button button-small danger hint--bottom" data-hint="Delete" data-backup data-ajax="{{ backup_delete }}"><i class="fa fa-close"></i></span>
</td>
</tr>
{% endfor %}
Expand Down
4 changes: 2 additions & 2 deletions themes/grav/templates/partials/backups-button.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% set profiles = grav.backups.getBackupProfiles() %}
{% set backup_url = uri.addNonce(base_url_relative ~ "/backup.json/id" ~ config.system.param_sep ~ "%BACKUP_ID/task" ~ config.system.param_sep ~ "backup", 'admin-form', 'admin-nonce') %}

<button class="button" data-ajax="{{ backup_url|replace({'%BACKUP_ID':'0'}) }}">
<button class="button" data-backup 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">
Expand All @@ -11,7 +11,7 @@
<ul class="dropdown-menu">
{% for id, profile in profiles %}
<li>
<a data-ajax="{{ backup_url|replace({'%BACKUP_ID':id}) }}" class="button">{{ profile.name }}</a>
<a data-backup data-ajax="{{ backup_url|replace({'%BACKUP_ID':id}) }}" class="button">{{ profile.name }}</a>
</li>
{% endfor %}
<li>
Expand Down

0 comments on commit bfb0b8e

Please sign in to comment.