diff --git a/apps/files/css/files.scss b/apps/files/css/files.scss index 7c2d3b0bb1cbf..d25044be539f5 100644 --- a/apps/files/css/files.scss +++ b/apps/files/css/files.scss @@ -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'); diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php index b89d468f9b0a5..32197dbe686cb 100644 --- a/apps/files_sharing/appinfo/app.php +++ b/apps/files_sharing/appinfo/app.php @@ -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 [ diff --git a/apps/files_sharing/js/app.js b/apps/files_sharing/js/app.js index e6c9159eda447..831288cca3c23 100644 --- a/apps/files_sharing/js/app.js +++ b/apps/files_sharing/js/app.js @@ -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('
' + + '' + t('files_sharing', 'Shared files and folders will show up here') + '
'); + return this._sharingFileList; + }, initSharingIn: function($el) { if (this._inFileList) { @@ -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(); @@ -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; @@ -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)); });