diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-09-02 10:41:08 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-09-14 20:45:30 +0200 |
commit | d0cea829698294621edff40502feae90a2d3b5ef (patch) | |
tree | 5bd943d12a154b097ae60196f2eab72b9425f77d /apps | |
parent | 8a6574e81a7c0d44c908ce2b4740f004124f63c8 (diff) | |
download | nextcloud-server-d0cea829698294621edff40502feae90a2d3b5ef.tar.gz nextcloud-server-d0cea829698294621edff40502feae90a2d3b5ef.zip |
Fixed sidebar toggle entry
Properly highlight the row after selecting the item.
This also fixes the unit tests by changing the order of registration of
file actions.
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/js/filelist.js | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index d8d73c8a00c..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,24 +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.fileActions.registerAction({ - name: 'Details', - mime: 'all', - permissions: OC.PERMISSION_READ, - actionHandler: function(fileName, context) { - var fileInfo = self.elementToFile(context.$file); - self._updateDetailsView(fileInfo); - OC.Apps.showAppSidebar(); - } - }); - } - this.$el.find('#controls').prepend(this.breadcrumb.$el); this._renderNewButton(); @@ -296,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); |