From 60bcdc550e95fbf0104bbc9c8028777016d73663 Mon Sep 17 00:00:00 2001 From: Vincent Petry <pvince81@owncloud.com> Date: Mon, 19 May 2014 15:20:44 +0200 Subject: Fixed file actions for sharing views FileActions can now be clone to be use for separate file list views without having the side-effect of affecting the main file list view. Added "Open" action in sharing overview file lists to redirect to the regular file list when clicking on a folder. --- apps/files_sharing/js/app.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'apps/files_sharing/js/app.js') diff --git a/apps/files_sharing/js/app.js b/apps/files_sharing/js/app.js index 887575193d0..9808e069784 100644 --- a/apps/files_sharing/js/app.js +++ b/apps/files_sharing/js/app.js @@ -27,9 +27,7 @@ OCA.Sharing.App = { } ); - var fileActions = _.extend({}, OCA.Files.FileActions); - fileActions.registerDefaultActions(this._inFileList); - this._inFileList.setFileActions(fileActions); + this._initFileActions(this._inFileList); }, initSharingOut: function($el) { @@ -44,9 +42,18 @@ OCA.Sharing.App = { } ); - var fileActions = _.extend({}, OCA.Files.FileActions); - fileActions.registerDefaultActions(this._outFileList); - this._outFileList.setFileActions(fileActions); + this._initFileActions(this._outFileList); + }, + + _initFileActions: function(fileList) { + var fileActions = OCA.Files.FileActions.clone(); + // when the user clicks on a folder, redirect to the corresponding + // folder in the files app + fileActions.register('dir', 'Open', OC.PERMISSION_READ, '', function (filename, context) { + OCA.Files.App.setActiveView('files', {silent: true}); + OCA.Files.App.fileList.changeDirectory(context.$file.attr('data-path') + '/' + filename, true, true); + }); + fileList.setFileActions(fileActions); } }; -- cgit v1.2.3