diff options
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/js/breadcrumb.js | 23 | ||||
-rw-r--r-- | apps/files/js/filelist.js | 27 |
2 files changed, 43 insertions, 7 deletions
diff --git a/apps/files/js/breadcrumb.js b/apps/files/js/breadcrumb.js index 98de7aa374c..ff9700456da 100644 --- a/apps/files/js/breadcrumb.js +++ b/apps/files/js/breadcrumb.js @@ -45,6 +45,7 @@ if (options.getCrumbUrl) { this.getCrumbUrl = options.getCrumbUrl; } + this._detailViews = []; }; /** * @memberof OCA.Files @@ -52,6 +53,7 @@ BreadCrumb.prototype = { $el: null, dir: null, + dirInfo: null, /** * Total width of all breadcrumbs @@ -79,6 +81,20 @@ } }, + setDirectoryInfo: function(dirInfo) { + if (dirInfo !== this.dirInfo) { + this.dirInfo = dirInfo; + this.render(); + } + }, + + /** + * @param {Backbone.View} detailView + */ + addDetailView: function(detailView) { + this._detailViews.push(detailView); + }, + /** * Returns the full URL to the given directory * @@ -122,6 +138,13 @@ } $crumb.addClass('last'); + _.each(this._detailViews, function(view) { + view.render({ + dirInfo: this.dirInfo + }); + $crumb.append(view.$el); + }, this); + // in case svg is not supported by the browser we need to execute the fallback mechanism if (!OC.Util.hasSVGSupport()) { OC.Util.replaceSVG(this.$el); diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 18534db3ee9..c53fa4f3d66 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -473,7 +473,7 @@ * Displays the details view for the given file and * selects the given tab * - * @param {string} fileName file name for which to show details + * @param {string|OCA.Files.FileInfoModel} fileName file name or FileInfoModel for which to show details * @param {string} [tabId] optional tab id to select */ showDetailsView: function(fileName, tabId) { @@ -487,7 +487,7 @@ /** * Update the details view to display the given file * - * @param {string} fileName file name from the current list + * @param {string|OCA.Files.FileInfoModel} fileName file name from the current list or a FileInfoModel object * @param {boolean} [show=true] whether to open the sidebar if it was closed */ _updateDetailsView: function(fileName, show) { @@ -518,13 +518,16 @@ OC.Apps.showAppSidebar(this._detailsView.$el); } - var $tr = this.findFileEl(fileName); - var model = this.getModelForFile($tr); + if (fileName instanceof OCA.Files.FileInfoModel) { + var model = fileName; + } else { + var $tr = this.findFileEl(fileName); + var model = this.getModelForFile($tr); + $tr.addClass('highlighted'); + } this._currentFileModel = model; - $tr.addClass('highlighted'); - this._detailsView.setFileInfo(model); this._detailsView.$el.scrollTop(0); }, @@ -1646,6 +1649,7 @@ // first entry is the root this.dirInfo = result.shift(); + this.breadcrumb.setDirectoryInfo(this.dirInfo); if (this.dirInfo.permissions) { this.setDirectoryPermissions(this.dirInfo.permissions); @@ -2021,7 +2025,7 @@ function updateInList(fileInfo) { self.updateRow(tr, fileInfo); - self._updateDetailsView(fileInfo.name, false); + self._updateDetailsView(fileInfo, false); } // TODO: too many nested blocks, move parts into functions @@ -2954,6 +2958,15 @@ if (this._detailsView) { this._detailsView.addDetailView(detailView); } + }, + + /** + * Register a view to be added to the breadcrumb view + */ + registerBreadCrumbDetailView: function(detailView) { + if (this.breadcrumb) { + this.breadcrumb.addDetailView(detailView); + } } }; |