diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-08-14 15:54:27 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-08-14 16:51:04 +0200 |
commit | e2549fa660630c1345dcdc84be9114ad2e54c0aa (patch) | |
tree | 0529f045d6f03f793bae98aac58894fd663a0913 /apps/files_sharing/js | |
parent | 4e327d058c66b98b8ff357589f339e57400c7a63 (diff) | |
download | nextcloud-server-e2549fa660630c1345dcdc84be9114ad2e54c0aa.tar.gz nextcloud-server-e2549fa660630c1345dcdc84be9114ad2e54c0aa.zip |
Improve right sidebar tabs behavior
Tab heads are not rendered if only one tab.
The tab contents is updated on-demand. This means that if a tab is not
visible it is not rendered at first. If the tab was already rendered
through switching, its model will not get updated until the next time it
becomes visible. This will prevent needless rerendering of invisible tab
contents, especially considering that some tabs might need extra ajax
requests.
Diffstat (limited to 'apps/files_sharing/js')
-rw-r--r-- | apps/files_sharing/js/share.js | 8 | ||||
-rw-r--r-- | apps/files_sharing/js/sharetabview.js | 9 |
2 files changed, 15 insertions, 2 deletions
diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index 04700b84011..c124d390d04 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -60,6 +60,14 @@ return tr; }; + var oldElementToFile = fileList.elementToFile; + fileList.elementToFile = function($el) { + var fileInfo = oldElementToFile.apply(this, arguments); + fileInfo.sharePermissions = $el.attr('data-share-permissions') || undefined; + fileInfo.shareOwner = $el.attr('data-share-owner') || undefined; + return fileInfo; + }; + // use delegate to catch the case with multiple file lists fileList.$el.on('fileActionsReady', function(ev){ var fileList = ev.fileList; diff --git a/apps/files_sharing/js/sharetabview.js b/apps/files_sharing/js/sharetabview.js index 5f4a21a4a57..ee572b747ea 100644 --- a/apps/files_sharing/js/sharetabview.js +++ b/apps/files_sharing/js/sharetabview.js @@ -10,7 +10,7 @@ (function() { var TEMPLATE = - '<div>Owner: {{owner}}'; + '<div><ul>{{#if owner}}<li>Owner: {{owner}}</li>{{/if}}</ul></div>'; /** * @memberof OCA.Sharing @@ -37,8 +37,13 @@ } if (this.model) { + console.log(this.model); + var owner = this.model.get('shareOwner'); + if (owner === OC.currentUser) { + owner = null; + } this.$el.append(this._template({ - owner: this.model.get('shareOwner') || OC.currentUser + owner: owner })); } else { |