summaryrefslogtreecommitdiffstats
path: root/core/js/oc-dialogs.js
diff options
context:
space:
mode:
authorThomas Tanghus <thomas@tanghus.net>2013-09-11 16:02:12 +0200
committerThomas Tanghus <thomas@tanghus.net>2013-09-11 16:02:12 +0200
commit799c5c2c9b3fdfd4c4d407e352c9dff494d86cc0 (patch)
treec8fd5835f00b8e61f277059ce1958237274cd9f8 /core/js/oc-dialogs.js
parenta2ade4294cae84f592ad32a21b1d3beaa696844f (diff)
downloadnextcloud-server-799c5c2c9b3fdfd4c4d407e352c9dff494d86cc0.tar.gz
nextcloud-server-799c5c2c9b3fdfd4c4d407e352c9dff494d86cc0.zip
Don't popup meaningless alerts when dialog called on page leave
Diffstat (limited to 'core/js/oc-dialogs.js')
-rw-r--r--core/js/oc-dialogs.js30
1 files changed, 21 insertions, 9 deletions
diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js
index f184a1022bc..a3516f866d1 100644
--- a/core/js/oc-dialogs.js
+++ b/core/js/oc-dialogs.js
@@ -139,8 +139,14 @@ var OCdialogs = {
}
});
})
- .fail(function() {
- alert(t('core', 'Error loading file picker template'));
+ .fail(function(status, error) {
+ // If the method is called while navigating away
+ // from the page, it is probably not needed ;)
+ if(status === 0) {
+ return;
+ } else {
+ alert(t('core', 'Error loading file picker template: {error}', {error: error}));
+ }
});
},
/**
@@ -206,8 +212,14 @@ var OCdialogs = {
});
OCdialogs.dialogs_counter++;
})
- .fail(function() {
- alert(t('core', 'Error loading file picker template'));
+ .fail(function(status, error) {
+ // If the method is called while navigating away from
+ // the page, we still want to deliver the message.
+ if(status === 0) {
+ alert(title + ': ' + content);
+ } else {
+ alert(t('core', 'Error loading message template: {error}', {error: error}));
+ }
});
},
_getFilePickerTemplate: function() {
@@ -219,8 +231,8 @@ var OCdialogs = {
self.$listTmpl = self.$filePickerTemplate.find('.filelist li:first-child').detach();
defer.resolve(self.$filePickerTemplate);
})
- .fail(function() {
- defer.reject();
+ .fail(function(jqXHR, textStatus, errorThrown) {
+ defer.reject(jqXHR.status, errorThrown);
});
} else {
defer.resolve(this.$filePickerTemplate);
@@ -231,12 +243,12 @@ var OCdialogs = {
var defer = $.Deferred();
if(!this.$messageTemplate) {
var self = this;
- $.get(OC.filePath('core', 'templates', 'message.html'), function(tmpl) {
+ $.get(OC.filePath('core', 'templates', 'message.htm'), function(tmpl) {
self.$messageTemplate = $(tmpl);
defer.resolve(self.$messageTemplate);
})
- .fail(function() {
- defer.reject();
+ .fail(function(jqXHR, textStatus, errorThrown) {
+ defer.reject(jqXHR.status, errorThrown);
});
} else {
defer.resolve(this.$messageTemplate);