From fdc2e8ba56c530fbbca5392b8a3752ac7ef53601 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 14 Oct 2016 16:23:11 +0200 Subject: [PATCH 1/2] Add file action to move files and folders Signed-off-by: Robin Appelman --- apps/files/js/fileactions.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index 015635c2e1d84..8d2178578e58f 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -617,6 +617,20 @@ } }); + this.registerAction({ + name: 'Move', + displayName: t('files', 'Move'), + mime: 'all', + order: -25, + permissions: OC.PERMISSION_UPDATE, + iconClass: 'icon-rename', + actionHandler: function (filename, context) { + OC.dialogs.filepicker(t('files', 'Target folder'), function(targetPath) { + context.fileList.move(filename, targetPath); + }, false, "httpd/unix-directory", true); + } + }); + this.register('dir', 'Open', OC.PERMISSION_READ, '', function (filename, context) { var dir = context.$file.attr('data-path') || context.fileList.getCurrentDirectory(); context.fileList.changeDirectory(OC.joinPaths(dir, filename), true, false, parseInt(context.$file.attr('data-id'), 10)); From 2b794902014264a3793daf42a2ecfa95a1a07342 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Mon, 17 Oct 2016 18:52:25 +0200 Subject: [PATCH 2/2] use more fitting icon for files move action --- apps/files/js/fileactions.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index 8d2178578e58f..3e0cf998254fe 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -363,7 +363,7 @@ /** * Renders the menu trigger on the given file list row - * + * * @param {Object} $tr file list row element * @param {OCA.Files.FileActionContext} context rendering context */ @@ -623,7 +623,7 @@ mime: 'all', order: -25, permissions: OC.PERMISSION_UPDATE, - iconClass: 'icon-rename', + iconClass: 'icon-external', actionHandler: function (filename, context) { OC.dialogs.filepicker(t('files', 'Target folder'), function(targetPath) { context.fileList.move(filename, targetPath); @@ -758,7 +758,7 @@ OCA.Files.legacyFileActions = new OCA.Files.FileActions(); // for backward compatibility - // + // // legacy apps are expecting a stateful global FileActions object to register // their actions on. Since legacy apps are very likely to break with other // FileList views than the main one ("All files"), actions registered @@ -777,4 +777,3 @@ OCA.Files.FileActions.prototype.display.call(window.FileActions, parent, triggerEvent, fileList); }; })(); -