summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-08-29 15:51:54 +0200
committerGitHub <noreply@github.com>2016-08-29 15:51:54 +0200
commit8dd5bbe7fee7811b3252771c0befb80ebd860832 (patch)
tree6be331e6f09df453bac0f0f8fb88c885eadd55d5 /core
parent490c219893340f25b0e2983f047c8a5bff0b2f1a (diff)
parent14c81f8a3a36674fa9b399bb3f640ff63d72993e (diff)
downloadnextcloud-server-8dd5bbe7fee7811b3252771c0befb80ebd860832.tar.gz
nextcloud-server-8dd5bbe7fee7811b3252771c0befb80ebd860832.zip
Merge pull request #1135 from nextcloud/choose-buttons
Choose button remains disabled unless files are chosen
Diffstat (limited to 'core')
-rw-r--r--core/js/oc-dialogs.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js
index b77063a9eae..75c8ef9020e 100644
--- a/core/js/oc-dialogs.js
+++ b/core/js/oc-dialogs.js
@@ -218,6 +218,13 @@ var OCdialogs = {
self.$filePicker = null;
}
});
+
+ // We can access primary class only from oc-dialog.
+ // Hence this is one of the approach to get the choose button.
+ var getOcDialog = self.$filePicker.closest('.oc-dialog');
+ var buttonEnableDisable = getOcDialog.find('.primary');
+ buttonEnableDisable.prop("disabled", "true");
+
if (!OC.Util.hasSVGSupport()) {
OC.Util.replaceSVG(self.$filePicker.parent());
}
@@ -812,18 +819,25 @@ var OCdialogs = {
var self = event.data;
var dir = $(event.target).data('dir');
self._fillFilePicker(dir);
+ var getOcDialog = this.closest('.oc-dialog');
+ var buttonEnableDisable = $('.primary', getOcDialog);
+ buttonEnableDisable.prop("disabled", true);
},
/**
* handle clicks made in the filepicker
*/
_handlePickerClick:function(event, $element) {
+ var getOcDialog = this.$filePicker.closest('.oc-dialog');
+ var buttonEnableDisable = getOcDialog.find('.primary');
if ($element.data('type') === 'file') {
if (this.$filePicker.data('multiselect') !== true || !event.ctrlKey) {
this.$filelist.find('.filepicker_element_selected').removeClass('filepicker_element_selected');
}
$element.toggleClass('filepicker_element_selected');
+ buttonEnableDisable.prop("disabled", false);
} else if ( $element.data('type') === 'dir' ) {
this._fillFilePicker(this.$filePicker.data('path') + '/' + $element.data('entryname'));
+ buttonEnableDisable.prop("disabled", true);
}
}
};