mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 08:44:07 -04:00
Add extra filter for file picker
Makes it possible to be more flexible when filtering entries to be displayed. Signed-off-by: Vincent Petry <vincent@nextcloud.com> Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
This commit is contained in:
parent
3ca797129c
commit
089b0a643e
5 changed files with 15 additions and 6 deletions
|
|
@ -243,6 +243,7 @@ const Dialogs = {
|
|||
* @param {string} [type] Type of file picker : Choose, copy, move, copy and move
|
||||
* @param {string} [path] path to the folder that the the file can be picket from
|
||||
* @param {Object} [options] additonal options that need to be set
|
||||
* @param {Function} [options.filter] filter function for advanced filtering
|
||||
*/
|
||||
filepicker: function(title, callback, multiselect, mimetypeFilter, modal, type, path, options) {
|
||||
var self = this
|
||||
|
|
@ -296,6 +297,9 @@ const Dialogs = {
|
|||
sizeCol: t('core', 'Size'),
|
||||
modifiedCol: t('core', 'Modified')
|
||||
}).data('path', path).data('multiselect', multiselect).data('mimetype', mimetypeFilter).data('allowDirectoryChooser', options.allowDirectoryChooser)
|
||||
if (typeof(options.filter) === 'function') {
|
||||
self.$filePicker.data('filter', options.filter)
|
||||
}
|
||||
|
||||
if (modal === undefined) {
|
||||
modal = false
|
||||
|
|
@ -1124,6 +1128,7 @@ const Dialogs = {
|
|||
this.$filelistContainer.addClass('icon-loading')
|
||||
this.$filePicker.data('path', dir)
|
||||
var filter = this.$filePicker.data('mimetype')
|
||||
var advancedFilter = this.$filePicker.data('filter')
|
||||
if (typeof (filter) === 'string') {
|
||||
filter = [filter]
|
||||
}
|
||||
|
|
@ -1142,6 +1147,10 @@ const Dialogs = {
|
|||
})
|
||||
}
|
||||
|
||||
if (advancedFilter) {
|
||||
files = files.filter(advancedFilter)
|
||||
}
|
||||
|
||||
// Check if the showHidden input field exist and if it exist follow it
|
||||
// Otherwise just show the hidden files
|
||||
const showHiddenInput = document.getElementById('showHiddenFiles')
|
||||
|
|
|
|||
4
dist/core-login.js
vendored
4
dist/core-login.js
vendored
File diff suppressed because one or more lines are too long
2
dist/core-login.js.map
vendored
2
dist/core-login.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/core-main.js
vendored
4
dist/core-main.js
vendored
File diff suppressed because one or more lines are too long
2
dist/core-main.js.map
vendored
2
dist/core-main.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue