summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-06-04 11:10:11 +0200
committerVincent Petry <pvince81@owncloud.com>2014-06-04 11:10:11 +0200
commitb3fdda175158fee77d76131e4dfa479b34f7d788 (patch)
tree9b12b0aebe06d1c26243694208fb3e46565b0588 /apps/files_sharing/js
parent3a1994d00149bea6d554c96a3bdee3126cfb17b8 (diff)
downloadnextcloud-server-b3fdda175158fee77d76131e4dfa479b34f7d788.tar.gz
nextcloud-server-b3fdda175158fee77d76131e4dfa479b34f7d788.zip
Added "Shared with link" sidebar section in files app
Added section to only show link shares. Please note that the filtering is currently done on the client side which might not be the most efficient way of doing it.
Diffstat (limited to 'apps/files_sharing/js')
-rw-r--r--apps/files_sharing/js/app.js31
-rw-r--r--apps/files_sharing/js/sharedfilelist.js17
2 files changed, 46 insertions, 2 deletions
diff --git a/apps/files_sharing/js/app.js b/apps/files_sharing/js/app.js
index 3764328a5d0..3c7720e2397 100644
--- a/apps/files_sharing/js/app.js
+++ b/apps/files_sharing/js/app.js
@@ -53,6 +53,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 with link');
+ this._linkFileList.$el.find('#emptycontent').text(t('files_sharing', 'You haven\'t shared any files with link yet.'));
+ return this._linkFileList;
+ },
+
removeSharingIn: function() {
if (this._inFileList) {
this._inFileList.$fileList.empty();
@@ -65,6 +84,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();
@@ -102,5 +127,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 ef1034ecfdc..fa39ded3c3e 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;
+ }
},
_createRow: function(fileData) {
@@ -130,12 +135,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