diff options
author | Frank Karlitschek <karlitschek@gmx.de> | 2015-09-15 14:45:34 +0200 |
---|---|---|
committer | Frank Karlitschek <karlitschek@gmx.de> | 2015-09-15 14:45:34 +0200 |
commit | 650e600b942d830460bb96de6726bdd1e8284a8e (patch) | |
tree | 07e3b830c21b41acc934fdd710a98bfe6400f9f8 /apps | |
parent | decdaf001855060862817e47d2a8d3d7dbb64043 (diff) | |
parent | d0cea829698294621edff40502feae90a2d3b5ef (diff) | |
download | nextcloud-server-650e600b942d830460bb96de6726bdd1e8284a8e.tar.gz nextcloud-server-650e600b942d830460bb96de6726bdd1e8284a8e.zip |
Merge pull request #18273 from owncloud/files-sidebar-toggle
Keep right sidebar open, add Details action
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/js/filelist.js | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index c52e414e3a7..3e12573c046 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -193,7 +193,19 @@ this.$container = options.scrollContainer || $(window); this.$table = $el.find('table:first'); this.$fileList = $el.find('#fileList'); + + if (_.isUndefined(options.detailsViewEnabled) || options.detailsViewEnabled) { + this._detailsView = new OCA.Files.DetailsView(); + this._detailsView.$el.insertBefore(this.$el); + this._detailsView.$el.addClass('disappear'); + } + this._initFileActions(options.fileActions); + + if (this._detailsView) { + this._detailsView.addDetailView(new OCA.Files.MainFileInfoDetailView({fileList: this, fileActions: this.fileActions})); + } + this.files = []; this._selectedFiles = {}; this._selectionSummary = new OCA.Files.FileSummary(); @@ -214,13 +226,6 @@ } this.breadcrumb = new OCA.Files.BreadCrumb(breadcrumbOptions); - if (_.isUndefined(options.detailsViewEnabled) || options.detailsViewEnabled) { - this._detailsView = new OCA.Files.DetailsView(); - this._detailsView.addDetailView(new OCA.Files.MainFileInfoDetailView({fileList: this, fileActions: this.fileActions})); - this._detailsView.$el.insertBefore(this.$el); - this._detailsView.$el.addClass('disappear'); - } - this.$el.find('#controls').prepend(this.breadcrumb.$el); this._renderNewButton(); @@ -285,11 +290,25 @@ * @param {OCA.Files.FileActions} fileActions file actions */ _initFileActions: function(fileActions) { + var self = this; this.fileActions = fileActions; if (!this.fileActions) { this.fileActions = new OCA.Files.FileActions(); this.fileActions.registerDefaultActions(); } + + if (this._detailsView) { + this.fileActions.registerAction({ + name: 'Details', + mime: 'all', + permissions: OC.PERMISSION_READ, + actionHandler: function(fileName, context) { + self._updateDetailsView(fileName); + OC.Apps.showAppSidebar(); + } + }); + } + this._onFileActionsUpdated = _.debounce(_.bind(this._onFileActionsUpdated, this), 100); this.fileActions.on('registerAction', this._onFileActionsUpdated); this.fileActions.on('setDefault', this._onFileActionsUpdated); @@ -366,7 +385,6 @@ } if (!fileName) { - OC.Apps.hideAppSidebar(this._detailsView.$el); this._detailsView.setFileInfo(null); if (this._currentFileModel) { this._currentFileModel.off(); @@ -384,7 +402,6 @@ this._detailsView.setFileInfo(model); this._detailsView.$el.scrollTop(0); - _.defer(OC.Apps.showAppSidebar, this._detailsView.$el); }, /** |