diff options
author | Julius Härtl <jus@bitgrid.net> | 2019-03-14 14:39:54 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2019-03-14 16:37:26 +0300 |
commit | 4878306bb471685977784e078e985bd166ad7f52 (patch) | |
tree | 71dbe0c85cae31f28137cdcbbfefe6900d7d454a /js/documents.js | |
parent | a2946b7c5453e0235f5e8047971c8df5ca28aec1 (diff) |
Use model from details view once available
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'js/documents.js')
-rw-r--r-- | js/documents.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/js/documents.js b/js/documents.js index 6dd053ca..0d348cbe 100644 --- a/js/documents.js +++ b/js/documents.js @@ -240,7 +240,7 @@ var documentsMain = { var $favorite = $('<li><a></a></li>').click(function(e) { $favorite.find('a').removeClass('icon-starred').removeClass('icon-star-dark').addClass('icon-loading-small'); documentsMain.getFileList().fileActions.triggerAction('Favorite', documentsMain.getFileModel(), documentsMain.getFileList()); - //documentsMain.getFileList().fileActions.actions.all.Favorite.action(documentsMain.fileName, context) + documentsMain.getFileModel().trigger('change', documentsMain.getFileModel()); }); if (isFavorite(context.fileInfoModel)) { $favorite.find('a').text(parent.t('files', 'Remove from favorites')); @@ -939,12 +939,22 @@ var documentsMain = { }, getFileModel: function() { + if (documentsMain.getFileList() && documentsMain.getFileList()._detailsView && documentsMain.getFileList()._detailsView.getFileInfo()) { + if (documentsMain.fileModel && documentsMain.fileModel !== documentsMain.getFileList()._detailsView.getFileInfo()) { + documentsMain.fileModel = documentsMain.getFileList()._detailsView.getFileInfo(); + documentsMain.fileModel.on('change', function () { + documentsMain.UI._addHeaderFileActions(); + }); + } + } + if (documentsMain.fileModel) { return documentsMain.fileModel; } if (documentsMain.getFileList()) { documentsMain.getFileList().scrollTo([documentsMain.fileName, '']); var fileModel = documentsMain.getFileList().getModelForFile(documentsMain.fileName); + if (fileModel) { fileModel.on('change', function () { documentsMain.UI._addHeaderFileActions(); |