Don't popup meaningless alerts when dialog called on page leave
This commit is contained in:
parent
a2ade4294c
commit
799c5c2c9b
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue