diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-08-30 14:23:47 +0200 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-08-30 14:23:47 +0200 |
commit | f080fa55ac606b498e3e1144a5fb58513e7ad1a3 (patch) | |
tree | 48ab801b7decff678ec6b8a506b665de05b8c6ff /core | |
parent | 66f2b155cecbd6b066fbc6c1efa7317e24f79915 (diff) | |
download | nextcloud-server-f080fa55ac606b498e3e1144a5fb58513e7ad1a3.tar.gz nextcloud-server-f080fa55ac606b498e3e1144a5fb58513e7ad1a3.zip |
Store the mime type filter always as an array
This will make easier to check if both directories and files should be
pickable.
This also removes an unused assignment to the mime type.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/js/oc-dialogs.js | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js index a9f9426c488..ee1e84033d4 100644 --- a/core/js/oc-dialogs.js +++ b/core/js/oc-dialogs.js @@ -206,6 +206,14 @@ var OCdialogs = { if(self.$filePicker) { self.$filePicker.ocdialog('close'); } + + if (mimetypeFilter === undefined || mimetypeFilter === null) { + mimetypeFilter = []; + } + if (typeof(mimetypeFilter) === "string") { + mimetypeFilter = [mimetypeFilter]; + } + self.$filePicker = $tmpl.octemplate({ dialog_name: dialogName, title: title, @@ -218,9 +226,6 @@ var OCdialogs = { if (multiselect === undefined) { multiselect = false; } - if (mimetypeFilter === undefined) { - mimetypeFilter = ''; - } $('body').append(self.$filePicker); @@ -315,7 +320,7 @@ var OCdialogs = { // Hence this is one of the approach to get the choose button. var getOcDialog = self.$filePicker.closest('.oc-dialog'); var buttonEnableDisable = getOcDialog.find('.primary'); - if (self.$filePicker.data('mimetype') === "httpd/unix-directory") { + if (self.$filePicker.data('mimetype').indexOf("httpd/unix-directory") !== -1) { buttonEnableDisable.prop("disabled", false); } else { buttonEnableDisable.prop("disabled", true); @@ -939,7 +944,7 @@ var OCdialogs = { var getOcDialog = (event.target).closest('.oc-dialog'); var buttonEnableDisable = $('.primary', getOcDialog); this._changeButtonsText(type, dir.split(/[/]+/).pop()); - if (this.$filePicker.data('mimetype') === "httpd/unix-directory") { + if (this.$filePicker.data('mimetype').indexOf("httpd/unix-directory") !== -1) { buttonEnableDisable.prop("disabled", false); } else { buttonEnableDisable.prop("disabled", true); @@ -960,7 +965,7 @@ var OCdialogs = { } else if ( $element.data('type') === 'dir' ) { this._fillFilePicker(this.$filePicker.data('path') + '/' + $element.data('entryname')); this._changeButtonsText(type, $element.data('entryname')); - if (this.$filePicker.data('mimetype') === "httpd/unix-directory") { + if (this.$filePicker.data('mimetype').indexOf("httpd/unix-directory") !== -1) { buttonEnableDisable.prop("disabled", false); } else { buttonEnableDisable.prop("disabled", true); |