]> source.dussan.org Git - nextcloud-server.git/commitdiff
Choose button remains disabled unless files are chosen 1135/head
authorSujith Haridasan <Sujith_Haridasan@mentor.com>
Mon, 22 Aug 2016 12:21:47 +0000 (17:51 +0530)
committerLukas Reschke <lukas@statuscode.ch>
Mon, 29 Aug 2016 12:25:26 +0000 (14:25 +0200)
from filepicker

This is will help user to understand that you can only
click choose button once the files are selected from the
file picker. This addresses the solution for issue 16106

Signed-off-by: Sujith Haridasan <Sujith_Haridasan@mentor.com>
core/js/oc-dialogs.js

index b77063a9eae9072cfc3300986f7ef94c36aefff7..75c8ef9020efeef73c5eaf418c414c117e55110c 100644 (file)
@@ -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);
                }
        }
 };