aboutsummaryrefslogtreecommitdiff
path: root/data/assets/js/admin/tabs
diff options
context:
space:
mode:
Diffstat (limited to 'data/assets/js/admin/tabs')
-rw-r--r--data/assets/js/admin/tabs/files.js40
-rw-r--r--data/assets/js/admin/tabs/posts.js12
2 files changed, 5 insertions, 47 deletions
diff --git a/data/assets/js/admin/tabs/files.js b/data/assets/js/admin/tabs/files.js
index bfd1943..1c01476 100644
--- a/data/assets/js/admin/tabs/files.js
+++ b/data/assets/js/admin/tabs/files.js
@@ -151,15 +151,7 @@ jQuery(function($) {
btns.toggleClass('disabled').find('.loading').toggleClass('hidden');
// list.html('');
}).fail(function(r) {
- var error = r.responseText;
-
- try {
- var data = $.parseJSON(r.responseText);
- if (data.error)
- error = data.error;
- } catch (e) {}
-
- alert("Error: " + error);
+ gripe(r, 'list files');
}).done(function(r) {
// disable action buttons
$('#file-actions li').addClass('disabled');
@@ -273,15 +265,7 @@ jQuery(function($) {
}).always(function() {
// TODO: need loading handler
}).fail(function(r) {
- var error = r.responseText;
-
- try {
- var data = $.parseJSON(r.responseText);
- if (data.error)
- error = data.error;
- } catch (e) {}
-
- alert("Error: " + error);
+ gripe(r, 'move file');
}).done(function() {
// reload file list
reload();
@@ -295,15 +279,7 @@ jQuery(function($) {
}).always(function() {
// TODO: need loading handler
}).fail(function(r) {
- var error = r.responseText;
-
- try {
- var data = $.parseJSON(r.responseText);
- if (data.error)
- error = data.error;
- } catch (e) {}
-
- alert("Error: " + error);
+ gripe(r, 'delete file');
}).done(function() {
// reload file list
reload();
@@ -345,15 +321,7 @@ jQuery(function($) {
// enable button, hide spinner
me.toggleClass('disabled').find('.loading').toggleClass('hidden');
}).fail(function(r) {
- var error = r.responseText;
-
- try {
- var data = $.parseJSON(r.responseText);
- if (data.error)
- error = data.error;
- } catch (e) {}
-
- alert("Error: " + error);
+ gripe(r, 'create folder');
}).done(function(r) {
// reload file list
reload();
diff --git a/data/assets/js/admin/tabs/posts.js b/data/assets/js/admin/tabs/posts.js
index a1e73c9..25f659e 100644
--- a/data/assets/js/admin/tabs/posts.js
+++ b/data/assets/js/admin/tabs/posts.js
@@ -167,18 +167,8 @@ jQuery(function($) {
$('body').trigger('click');
send(type + '/add').fail(function(r) {
- var msg = r.responseText;
-
- try {
- var data = $.parseJSON(r);
- if (data.error)
- msg = data.error;
- } catch (e) {}
-
- alert('Error: ' + msg);
+ gripe(r, 'add ' + type);
}).done(function(r) {
- console.log(r);
-
// show edit dialog
$('#' + type + '-edit-dialog').data('post_id', r.post_id).modal('show')
});