diff options
author | Joas Schilling <coding@schilljs.com> | 2019-09-25 14:55:13 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2019-12-09 15:55:39 +0100 |
commit | aa790a3961e49fcb996190dc3e3820dc6fce4011 (patch) | |
tree | 67c6ae02d982815210fbfe695c936f4d133e2bb9 /core/src | |
parent | e35a31f53ba1753714a30c41c700f6ac880d9abe (diff) | |
download | nextcloud-server-aa790a3961e49fcb996190dc3e3820dc6fce4011.tar.gz nextcloud-server-aa790a3961e49fcb996190dc3e3820dc6fce4011.zip |
Allow to have mutliple buttons on the filepicker
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/OC/dialogs.js | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/core/src/OC/dialogs.js b/core/src/OC/dialogs.js index a35af2f7c88..9d724b069ae 100644 --- a/core/src/OC/dialogs.js +++ b/core/src/OC/dialogs.js @@ -41,6 +41,7 @@ const Dialogs = { FILEPICKER_TYPE_MOVE: 2, FILEPICKER_TYPE_COPY: 3, FILEPICKER_TYPE_COPY_MOVE: 4, + FILEPICKER_TYPE_CUSTOM: 5, // used to name each dialog dialogsCounter: 0, @@ -446,6 +447,16 @@ const Dialogs = { click: chooseCallback, defaultButton: true }) + } else if (type === Dialogs.FILEPICKER_TYPE_CUSTOM) { + options.buttons.forEach(function(button) { + buttonlist.push({ + text: button.text, + click: function() { + functionToCall(button.type) + }, + defaultButton: button.defaultButton + }) + }) } else { if (type === Dialogs.FILEPICKER_TYPE_COPY || type === Dialogs.FILEPICKER_TYPE_COPY_MOVE) { buttonlist.push({ @@ -1253,18 +1264,20 @@ const Dialogs = { var moveText = dir === '' ? t('core', 'Move') : t('core', 'Move to {folder}', { folder: dir }) var buttons = $('.oc-dialog-buttonrow button') switch (type) { - case this.FILEPICKER_TYPE_CHOOSE: - break - case this.FILEPICKER_TYPE_COPY: - buttons.text(copyText) - break - case this.FILEPICKER_TYPE_MOVE: - buttons.text(moveText) - break - case this.FILEPICKER_TYPE_COPY_MOVE: - buttons.eq(0).text(copyText) - buttons.eq(1).text(moveText) - break + case this.FILEPICKER_TYPE_CHOOSE: + break + case this.FILEPICKER_TYPE_CUSTOM: + break + case this.FILEPICKER_TYPE_COPY: + buttons.text(copyText) + break + case this.FILEPICKER_TYPE_MOVE: + buttons.text(moveText) + break + case this.FILEPICKER_TYPE_COPY_MOVE: + buttons.eq(0).text(copyText) + buttons.eq(1).text(moveText) + break } } } |