diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2016-10-10 17:35:11 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2016-11-07 14:58:45 +0100 |
commit | c55718ae5e6eb3ebde519e3a4954e8b339734067 (patch) | |
tree | 641fc693d2dcc620d772cc87d6cdc375fee3b927 /apps | |
parent | 36cf77914069cd63b4d70d2ca0658f9000cddf78 (diff) | |
download | nextcloud-server-c55718ae5e6eb3ebde519e3a4954e8b339734067.tar.gz nextcloud-server-c55718ae5e6eb3ebde519e3a4954e8b339734067.zip |
update breadcrumb view whenever the share information on the directory info model changes
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/js/filelist.js | 10 | ||||
-rw-r--r-- | apps/files_sharing/js/sharebreadcrumbview.js | 12 |
2 files changed, 15 insertions, 7 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 5bdb1a8999d..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,8 +518,8 @@ OC.Apps.showAppSidebar(this._detailsView.$el); } - if (_.isObject(fileName)) { - var model = new OCA.Files.FileInfoModel(fileName); + if (fileName instanceof OCA.Files.FileInfoModel) { + var model = fileName; } else { var $tr = this.findFileEl(fileName); var model = this.getModelForFile($tr); @@ -2025,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 diff --git a/apps/files_sharing/js/sharebreadcrumbview.js b/apps/files_sharing/js/sharebreadcrumbview.js index c6bf365ba07..d29ba9d05dc 100644 --- a/apps/files_sharing/js/sharebreadcrumbview.js +++ b/apps/files_sharing/js/sharebreadcrumbview.js @@ -41,7 +41,7 @@ return this._template(data); }, render: function(data) { - this._dirInfo = data.dirInfo; + this._dirInfo = data.dirInfo || null; if (this._dirInfo !== null && (this._dirInfo.path !== '/' || this._dirInfo.name !== '')) { var isShared = data.dirInfo && data.dirInfo.shareTypes && data.dirInfo.shareTypes.length > 0; @@ -60,7 +60,15 @@ _onClick: function(e) { e.preventDefault(); - OCA.Files.App.fileList.showDetailsView(this._dirInfo, 'shareTabView'); + var fileInfoModel = new OCA.Files.FileInfoModel(this._dirInfo); + var self = this; + fileInfoModel.on('change', function() { + console.log('CHANGE'); + self.render({ + dirInfo: self._dirInfo + }); + }); + OCA.Files.App.fileList.showDetailsView(fileInfoModel, 'shareTabView'); } }); |