diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-06-05 10:59:54 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-06-05 10:59:54 +0200 |
commit | e0c4e960d9d1289c28dfbffde2fb9c1d30987f56 (patch) | |
tree | 5e0e4256ca05a1302040781637154b1bfd4d15b0 /apps/files_sharing/js | |
parent | f1bf06f8cfdcedf83c781ca704a1573dab07dabc (diff) | |
parent | 816db7aef1e2b67cc636d099f1571ae30f8a21a1 (diff) | |
download | nextcloud-server-e0c4e960d9d1289c28dfbffde2fb9c1d30987f56.tar.gz nextcloud-server-e0c4e960d9d1289c28dfbffde2fb9c1d30987f56.zip |
Merge pull request #8861 from owncloud/share-overview-linklist
Added Shared with link sidebar section in files app
Diffstat (limited to 'apps/files_sharing/js')
-rw-r--r-- | apps/files_sharing/js/app.js | 31 | ||||
-rw-r--r-- | apps/files_sharing/js/sharedfilelist.js | 17 |
2 files changed, 46 insertions, 2 deletions
diff --git a/apps/files_sharing/js/app.js b/apps/files_sharing/js/app.js index 800873cd638..1fc13d00382 100644 --- a/apps/files_sharing/js/app.js +++ b/apps/files_sharing/js/app.js @@ -55,6 +55,25 @@ OCA.Sharing.App = { return this._outFileList; }, + initSharingLinks: function($el) { + if (this._linkFileList) { + return this._linkFileList; + } + this._linkFileList = new OCA.Sharing.FileList( + $el, + { + scrollContainer: $('#app-content'), + linksOnly: true, + fileActions: this._createFileActions() + } + ); + + this._extendFileList(this._linkFileList); + this._linkFileList.appName = t('files_sharing', 'Shared by link'); + this._linkFileList.$el.find('#emptycontent').text(t('files_sharing', 'You haven\'t shared any files by link yet.')); + return this._linkFileList; + }, + removeSharingIn: function() { if (this._inFileList) { this._inFileList.$fileList.empty(); @@ -67,6 +86,12 @@ OCA.Sharing.App = { } }, + removeSharingLinks: function() { + if (this._linkFileList) { + this._linkFileList.$fileList.empty(); + } + }, + _createFileActions: function() { // inherit file actions from the files app var fileActions = new OCA.Files.FileActions(); @@ -104,5 +129,11 @@ $(document).ready(function() { $('#app-content-sharingout').on('hide', function() { OCA.Sharing.App.removeSharingOut(); }); + $('#app-content-sharinglinks').on('show', function(e) { + OCA.Sharing.App.initSharingLinks($(e.target)); + }); + $('#app-content-sharinglinks').on('hide', function() { + OCA.Sharing.App.removeSharingLinks(); + }); }); diff --git a/apps/files_sharing/js/sharedfilelist.js b/apps/files_sharing/js/sharedfilelist.js index 97fabf87131..304f77a8d77 100644 --- a/apps/files_sharing/js/sharedfilelist.js +++ b/apps/files_sharing/js/sharedfilelist.js @@ -26,6 +26,7 @@ * the files that the user shared with others (false). */ _sharedWithUser: false, + _linksOnly: false, initialize: function($el, options) { OCA.Files.FileList.prototype.initialize.apply(this, arguments); @@ -33,9 +34,13 @@ return; } + // TODO: consolidate both options if (options && options.sharedWithUser) { this._sharedWithUser = true; } + if (options && options.linksOnly) { + this._linksOnly = true; + } }, _renderRow: function() { @@ -137,12 +142,20 @@ * @return array of file info maps */ _makeFilesFromShares: function(data) { + /* jshint camelcase: false */ var self = this; + var files = data; + + if (this._linksOnly) { + files = _.filter(data, function(share) { + return share.share_type === OC.Share.SHARE_TYPE_LINK; + }); + } + // OCS API uses non-camelcased names - var files = _.chain(data) + files = _.chain(files) // convert share data to file data .map(function(share) { - /* jshint camelcase: false */ var file = { id: share.file_source, mimetype: share.mimetype |