diff options
author | Thomas Tanghus <thomas@tanghus.net> | 2013-09-14 10:35:39 -0700 |
---|---|---|
committer | Thomas Tanghus <thomas@tanghus.net> | 2013-09-14 10:35:39 -0700 |
commit | dcc899d0a0d9dfb2ca58c2ab4b71914c43538cf7 (patch) | |
tree | ccc39641d96316ea7e83747f808ba500c92b641d /core/js/oc-dialogs.js | |
parent | 556bd1ef23ca6176018a48e72f1e330269a69aab (diff) | |
parent | 08225a60c8e7535ae94726189a090679886ea47d (diff) | |
download | nextcloud-server-dcc899d0a0d9dfb2ca58c2ab4b71914c43538cf7.tar.gz nextcloud-server-dcc899d0a0d9dfb2ca58c2ab4b71914c43538cf7.zip |
Merge pull request #4806 from owncloud/oc-dialogs-pageleave
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.js | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js index 61b58d00fa6..961e2ae13a4 100644 --- a/core/js/oc-dialogs.js +++ b/core/js/oc-dialogs.js @@ -139,8 +139,12 @@ 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) { + alert(t('core', 'Error loading file picker template: {error}', {error: error})); + } }); }, /** @@ -206,8 +210,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 +229,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); @@ -235,8 +245,8 @@ var OCdialogs = { 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); |