summaryrefslogtreecommitdiffstats
path: root/apps/files/js/filelist.js
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2017-08-27 15:20:18 +0200
committerThomas Citharel <tcit@tcit.fr>2017-08-27 15:20:18 +0200
commit2af0c3d9283fa63aaf701eb3ebe51bbbec7aa250 (patch)
tree15e203494f6143b455685ebef4ee0cc16004d098 /apps/files/js/filelist.js
parenta17aba4e23c7ab6eecba7c655266f511e14212fc (diff)
downloadnextcloud-server-2af0c3d9283fa63aaf701eb3ebe51bbbec7aa250.tar.gz
nextcloud-server-2af0c3d9283fa63aaf701eb3ebe51bbbec7aa250.zip
Move multiple files
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
Diffstat (limited to 'apps/files/js/filelist.js')
-rw-r--r--apps/files/js/filelist.js38
1 files changed, 36 insertions, 2 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 79ec8e2d9f9..9e4d3983ea0 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -337,6 +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));
+ this.$el.find('.move').click(_.bind(this._onClickMoveSelected, this));
this.$el.find('.delete-selected').click(_.bind(this._onClickDeleteSelected, this));
this.$el.find('.selectedActions a').tooltip({placement:'top'});
@@ -751,13 +752,42 @@
OCA.Files.Files.handleDownload(this.getDownloadUrl(files, dir, true), disableLoadingState);
}
else {
- first = this.getSelectedFiles()[0];
+ var first = this.getSelectedFiles()[0];
OCA.Files.Files.handleDownload(this.getDownloadUrl(first.name, dir, true), disableLoadingState);
}
return false;
},
/**
+ * Event handler for when clicking on "Move" for the selected files
+ */
+ _onClickMoveSelected: function(event) {
+ var files;
+ var self = this;
+
+ files = _.pluck(this.getSelectedFiles(), 'name');
+
+ var moveFileAction = $('#selectedActionsList').find('.move');
+
+ // don't allow a second click on the download action
+ if(moveFileAction.hasClass('disabled')) {
+ event.preventDefault();
+ return;
+ }
+
+ var disableLoadingState = function(){
+ 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);
+ return false;
+ },
+
+
+ /**
* Event handler for when clicking on "Delete" for the selected files
*/
_onClickDeleteSelected: function(event) {
@@ -1949,8 +1979,9 @@
*
* @param fileNames array of file names to move
* @param targetPath absolute target path
+ * @param callback function to call when movement is finished
*/
- move: function(fileNames, targetPath) {
+ move: function(fileNames, targetPath, callback) {
var self = this;
var dir = this.getCurrentDirectory();
if (dir.charAt(dir.length - 1) !== '/') {
@@ -1999,6 +2030,9 @@
.always(function() {
self.showFileBusyState($tr, false);
});
+ if (callback) {
+ callback();
+ }
});
},