Skip to content

Commit 129fdf2

Browse files
Merge pull request #1754 from nextcloud/files-move
Add file action to move files and folders
2 parents 943d973 + 2b79490 commit 129fdf2

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

apps/files/js/fileactions.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@
363363

364364
/**
365365
* Renders the menu trigger on the given file list row
366-
*
366+
*
367367
* @param {Object} $tr file list row element
368368
* @param {OCA.Files.FileActionContext} context rendering context
369369
*/
@@ -617,6 +617,20 @@
617617
}
618618
});
619619

620+
this.registerAction({
621+
name: 'Move',
622+
displayName: t('files', 'Move'),
623+
mime: 'all',
624+
order: -25,
625+
permissions: OC.PERMISSION_UPDATE,
626+
iconClass: 'icon-external',
627+
actionHandler: function (filename, context) {
628+
OC.dialogs.filepicker(t('files', 'Target folder'), function(targetPath) {
629+
context.fileList.move(filename, targetPath);
630+
}, false, "httpd/unix-directory", true);
631+
}
632+
});
633+
620634
this.register('dir', 'Open', OC.PERMISSION_READ, '', function (filename, context) {
621635
var dir = context.$file.attr('data-path') || context.fileList.getCurrentDirectory();
622636
context.fileList.changeDirectory(OC.joinPaths(dir, filename), true, false, parseInt(context.$file.attr('data-id'), 10));
@@ -744,7 +758,7 @@
744758
OCA.Files.legacyFileActions = new OCA.Files.FileActions();
745759

746760
// for backward compatibility
747-
//
761+
//
748762
// legacy apps are expecting a stateful global FileActions object to register
749763
// their actions on. Since legacy apps are very likely to break with other
750764
// FileList views than the main one ("All files"), actions registered
@@ -763,4 +777,3 @@
763777
OCA.Files.FileActions.prototype.display.call(window.FileActions, parent, triggerEvent, fileList);
764778
};
765779
})();
766-

0 commit comments

Comments
 (0)