mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-15 17:56:07 +01:00
Added cache clear + toastr js lib for notifications
This commit is contained in:
@@ -21,6 +21,32 @@ $(function () {
|
||||
}
|
||||
});
|
||||
|
||||
// Set Toastr defaults
|
||||
toastr.options = {
|
||||
"positionClass": "toast-top-right"
|
||||
}
|
||||
|
||||
// Cache Clear
|
||||
$('[data-clear-cache]').on('click', function(e) {
|
||||
|
||||
$(this).attr('disabled','disabled').find('> .fa').removeClass('fa-trash').addClass('fa-refresh fa-spin');
|
||||
var url = $(this).data('clearCache');
|
||||
console.log(url);
|
||||
|
||||
var jqxhr = $.getJSON(url, function(result, status) {
|
||||
if (result.status == 'success') {
|
||||
toastr.success(result.message);
|
||||
} else {
|
||||
toastr.error(result.message);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
jqxhr.complete(function() {
|
||||
$('[data-clear-cache]').removeAttr('disabled').find('> .fa').removeClass('fa-refresh fa-spin').addClass('fa-trash');
|
||||
});
|
||||
});
|
||||
|
||||
// GPM
|
||||
$.post(window.location.href, {
|
||||
task: 'GPM',
|
||||
|
||||
Reference in New Issue
Block a user