Skip to content

Commit

Permalink
Start with unified Shared entry to view all shares, ref #5559
Browse files Browse the repository at this point in the history
Signed-off-by: Jan-Christoph Borchardt <hey@jancborchardt.net>
  • Loading branch information
jancborchardt committed Sep 28, 2017
1 parent 1c2da7d commit 1bfa8c3
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions apps/files/css/files.scss
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
.nav-icon-favorites {
background-image: url('../img/star.svg?v=1');
}
.nav-icon-sharing,
.nav-icon-sharingin,
.nav-icon-sharingout {
background-image: url('../img/share.svg?v=1');
Expand Down
11 changes: 11 additions & 0 deletions apps/files_sharing/appinfo/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ function() {

$config = \OC::$server->getConfig();
if ($config->getAppValue('core', 'shareapi_enabled', 'yes') === 'yes') {
\OCA\Files\App::getNavigationManager()->add(function () {
$l = \OC::$server->getL10N('files_sharing');
return [
'id' => 'sharing',
'appname' => 'files_sharing',
'script' => 'list.php',
'order' => 14,
'name' => $l->t('Shared'),
];
});

\OCA\Files\App::getNavigationManager()->add(function () {
$l = \OC::$server->getL10N('files_sharing');
return [
Expand Down
40 changes: 40 additions & 0 deletions apps/files_sharing/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,34 @@ if (!OCA.Sharing) {
*/
OCA.Sharing.App = {

_sharingFileList: null,
_inFileList: null,
_outFileList: null,
_linkFileList: null,

initSharing: function($el) {
if (this._sharingFileList) {
return this._sharingFileList;
}

this._sharingFileList = new OCA.Sharing.FileList(
$el,
{
id: 'shares.all',
scrollContainer: $('#app-content'),
sharedWithUser: true,
fileActions: this._createFileActions(),
config: OCA.Files.App.getFilesConfig()
}
);

this._extendFileList(this._sharingFileList);
this._sharingFileList.appName = t('files_sharing', 'Shared');
this._sharingFileList.$el.find('#emptycontent').html('<div class="icon-shared"></div>' +
'<h2>' + t('files_sharing', 'Nothing shared yet') + '</h2>' +
'<p>' + t('files_sharing', 'Shared files and folders will show up here') + '</p>');
return this._sharingFileList;
},

initSharingIn: function($el) {
if (this._inFileList) {
Expand Down Expand Up @@ -92,6 +118,12 @@ OCA.Sharing.App = {
return this._linkFileList;
},

removeSharing: function() {
if (this._sharingFileList) {
this._sharingFileList.$fileList.empty();
}
},

removeSharingIn: function() {
if (this._inFileList) {
this._inFileList.$fileList.empty();
Expand All @@ -116,9 +148,11 @@ OCA.Sharing.App = {
destroy: function() {
OCA.Files.fileActions.off('setDefault.app-sharing', this._onActionsUpdated);
OCA.Files.fileActions.off('registerAction.app-sharing', this._onActionsUpdated);
this.removeSharing();
this.removeSharingIn();
this.removeSharingOut();
this.removeSharingLinks();
this._sharingFileList = null;
this._inFileList = null;
this._outFileList = null;
this._linkFileList = null;
Expand Down Expand Up @@ -175,6 +209,12 @@ OCA.Sharing.App = {
};

$(document).ready(function() {
$('#app-content-sharing').on('show', function(e) {
OCA.Sharing.App.initSharing($(e.target));
});
$('#app-content-sharing').on('hide', function() {
OCA.Sharing.App.removeSharing();
});
$('#app-content-sharingin').on('show', function(e) {
OCA.Sharing.App.initSharingIn($(e.target));
});
Expand Down

0 comments on commit 1bfa8c3

Please sign in to comment.