diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-09-01 20:29:55 +0300 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-09-03 17:47:24 +0300 |
commit | 310d79728447ecf69f18d0b61a527397bd961888 (patch) | |
tree | 805b2a0a40ed5ce7acb58afb90ad7c18e760e037 /apps/files/js/tagsplugin.js | |
parent | e9e42fff61a922f11a3b1014d810562537950b6a (diff) |
Add versions tab to files sidebar
- move versions to a tab in the files sidebar
- added mechanism to auto-update the row in the FileList whenever values
are set to the FileInfoModel given to the sidebar
- updated tags/favorite action to make use of that new mechanism
Diffstat (limited to 'apps/files/js/tagsplugin.js')
-rw-r--r-- | apps/files/js/tagsplugin.js | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/apps/files/js/tagsplugin.js b/apps/files/js/tagsplugin.js index 609e38ca9a9..9f45da9a6e2 100644 --- a/apps/files/js/tagsplugin.js +++ b/apps/files/js/tagsplugin.js @@ -92,6 +92,7 @@ actionHandler: function(fileName, context) { var $actionEl = context.$file.find('.action-favorite'); var $file = context.$file; + var fileInfo = context.fileList.files[$file.index()]; var dir = context.dir || context.fileList.getCurrentDirectory(); var tags = $file.attr('data-tags'); if (_.isUndefined(tags)) { @@ -106,9 +107,11 @@ } else { tags.push(OC.TAG_FAVORITE); } + + // pre-toggle the star toggleStar($actionEl, !isFavorite); - context.fileInfoModel.set('tags', tags); + context.fileInfoModel.trigger('busy', context.fileInfoModel, true); self.applyFileTags( dir + '/' + fileName, @@ -116,17 +119,16 @@ $actionEl, isFavorite ).then(function(result) { + context.fileInfoModel.trigger('busy', context.fileInfoModel, false); // response from server should contain updated tags var newTags = result.tags; if (_.isUndefined(newTags)) { newTags = tags; } - var fileInfo = context.fileList.files[$file.index()]; - // read latest state from result - toggleStar($actionEl, (newTags.indexOf(OC.TAG_FAVORITE) >= 0)); - $file.attr('data-tags', newTags.join('|')); - $file.attr('data-favorite', !isFavorite); - fileInfo.tags = newTags; + context.fileInfoModel.set({ + 'tags': newTags, + 'favorite': !isFavorite + }); }); } }); |