diff options
author | Thomas Citharel <tcit@tcit.fr> | 2017-08-27 17:39:22 +0200 |
---|---|---|
committer | Thomas Citharel <tcit@tcit.fr> | 2017-09-15 16:53:10 +0200 |
commit | 33f0601862c337799235c06282764fc95fe21f02 (patch) | |
tree | 9d3a343f2e8294c5cd415e87cddf355eb395f863 /apps/files/js | |
parent | 246a5a5750dd2b8f990797b2c6cc4270a9a5b59d (diff) | |
download | nextcloud-server-33f0601862c337799235c06282764fc95fe21f02.tar.gz nextcloud-server-33f0601862c337799235c06282764fc95fe21f02.zip |
[WIP] Added copy and move buttons
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
Diffstat (limited to 'apps/files/js')
-rw-r--r-- | apps/files/js/fileactions.js | 29 | ||||
-rw-r--r-- | apps/files/js/filelist.js | 20 |
2 files changed, 20 insertions, 29 deletions
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index 527cbc0bd34..668960d5937 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -618,30 +618,21 @@ }); this.registerAction({ - name: 'Move', - displayName: t('files', 'Move'), + name: 'CopyMove', + displayName: t('files', 'Copy or Move'), mime: 'all', order: -25, permissions: OC.PERMISSION_UPDATE, iconClass: 'icon-external', actionHandler: function (filename, context) { - OC.dialogs.filepicker(t('files', 'Target folder'), function(targetPath) { - context.fileList.move(filename, targetPath); - }, false, "httpd/unix-directory", true); - } - }); - - this.registerAction({ - name: 'Copy', - displayName: t('files', 'Copy'), - mime: 'all', - order: -25, - permissions: OC.PERMISSION_READ, - iconClass: 'icon-external', - actionHandler: function (filename, context) { - OC.dialogs.filepicker(t('files', 'Target folder'), function(targetPath) { - context.fileList.copy(filename, targetPath); - }, false, "httpd/unix-directory", true); + OC.dialogs.filepicker(t('files', 'Target folder'), function(targetPath, type) { + if (type === OC.dialogs.FILEPICKER_TYPE_COPY) { + context.fileList.copy(filename, targetPath); + } + if (type === OC.dialogs.FILEPICKER_TYPE_MOVE) { + context.fileList.move(filename, targetPath); + } + }, false, "httpd/unix-directory", true, OC.dialogs.FILEPICKER_TYPE_COPY_MOVE); } }); diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 946ac125484..d67cb409b1e 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -337,11 +337,7 @@ this.$el.on('urlChanged', _.bind(this._onUrlChanged, this)); this.$el.find('.select-all').click(_.bind(this._onClickSelectAll, this)); this.$el.find('.download').click(_.bind(this._onClickDownloadSelected, this)); -<<<<<<< HEAD - this.$el.find('.move').click(_.bind(this._onClickMoveSelected, this)); -======= - this.$el.find('.copy').click(_.bind(this._onClickCopySelected, this)); ->>>>>>> Allow files to be copied through action menu & multiple files actions + this.$el.find('.copy-move').click(_.bind(this._onClickCopyMoveSelected, this)); this.$el.find('.delete-selected').click(_.bind(this._onClickDeleteSelected, this)); this.$el.find('.selectedActions a').tooltip({placement:'top'}); @@ -765,7 +761,7 @@ /** * Event handler for when clicking on "Move" for the selected files */ - _onClickMoveSelected: function(event) { + _onClickCopyMoveSelected: function(event) { var files; var self = this; @@ -783,10 +779,14 @@ OCA.Files.FileActions.updateFileActionSpinner(moveFileAction, false); }; - OCA.Files.FileActions.updateFileActionSpinner(moveFileAction, true); - OC.dialogs.filepicker(t('files', 'Target folder'), function(targetPath) { - self.move(files, targetPath, disableLoadingState); - }, false, "httpd/unix-directory", true); + OC.dialogs.filepicker(t('files', 'Target folder'), function(targetPath, type) { + if (type === OC.dialogs.FILEPICKER_TYPE_COPY) { + self.copy(files, targetPath, disableLoadingState); + } + if (type === OC.dialogs.FILEPICKER_TYPE_MOVE) { + self.move(files, targetPath, disableLoadingState); + } + }, false, "httpd/unix-directory", true, OC.dialogs.FILEPICKER_TYPE_COPY_MOVE); return false; }, |