summaryrefslogtreecommitdiffstats
path: root/core/js/oc-dialogs.js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-10-02 09:55:43 +0200
committerVincent Petry <pvince81@owncloud.com>2015-10-02 09:55:43 +0200
commit5dff9d88cb58c9c533a113d6cbde9d5b6acd1c92 (patch)
tree934bc1dfe5ed6baad55653f9f5e36a6eeb4564dd /core/js/oc-dialogs.js
parent3dec30d0e09128002f24f58b7ea042c42defce31 (diff)
downloadnextcloud-server-5dff9d88cb58c9c533a113d6cbde9d5b6acd1c92.tar.gz
nextcloud-server-5dff9d88cb58c9c533a113d6cbde9d5b6acd1c92.zip
Make sure the conflict dialog is loaded before adding conflicts
Diffstat (limited to 'core/js/oc-dialogs.js')
-rw-r--r--core/js/oc-dialogs.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js
index c38250c79c6..7af50c4ddfc 100644
--- a/core/js/oc-dialogs.js
+++ b/core/js/oc-dialogs.js
@@ -312,9 +312,11 @@ var OCdialogs = {
* @param {object} original file with name, size and mtime
* @param {object} replacement file with name, size and mtime
* @param {object} controller with onCancel, onSkip, onReplace and onRename methods
+ * @return {Promise} jquery promise that resolves after the dialog template was loaded
*/
fileexists:function(data, original, replacement, controller) {
var self = this;
+ var dialogDeferred = new $.Deferred();
var getCroppedPreview = function(file) {
var deferred = new $.Deferred();
@@ -540,7 +542,7 @@ var OCdialogs = {
//recalculate dimensions
$(window).trigger('resize');
-
+ dialogDeferred.resolve();
} else {
//create dialog
this._fileexistsshown = true;
@@ -559,8 +561,10 @@ var OCdialogs = {
});
$('body').append($dlg);
- var $conflicts = $dlg.find('.conflicts');
- addConflict($conflicts, original, replacement);
+ if (original && replacement) {
+ var $conflicts = $dlg.find('.conflicts');
+ addConflict($conflicts, original, replacement);
+ }
var buttonlist = [{
text: t('core', 'Cancel'),
@@ -612,7 +616,7 @@ var OCdialogs = {
});
$(dialogId).find('.conflicts').on('click', '.replacement input[type="checkbox"],.original:not(.readonly) input[type="checkbox"]', function() {
var $checkbox = $(this);
- $checkbox.prop('checked', !checkbox.prop('checked'));
+ $checkbox.prop('checked', !$checkbox.prop('checked'));
});
//update counters
@@ -643,12 +647,15 @@ var OCdialogs = {
$(dialogId).find('.allexistingfiles + .count').text('');
}
});
+ dialogDeferred.resolve();
})
.fail(function() {
+ dialogDeferred.reject();
alert(t('core', 'Error loading file exists template'));
});
}
//}
+ return dialogDeferred.promise();
},
_getFilePickerTemplate: function() {
var defer = $.Deferred();