update breadcrumb view whenever the share information on the directory info model changes

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst 2016-10-10 17:35:11 +02:00 committed by Roeland Jago Douma
parent 36cf779140
commit c55718ae5e
No known key found for this signature in database
GPG Key ID: 1E152838F164D13B
2 changed files with 15 additions and 7 deletions

View File

@ -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

View File

@ -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');
}
});