diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-08-24 13:00:03 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-09-16 07:23:26 +0200 |
commit | 018d07b3e55fd7234008c51d0a124b7b681a1a4f (patch) | |
tree | 9df1d49f9cb1b3277bfc81cae6319c796df993b0 /apps/files_sharing | |
parent | 6af6024e172bc4810691f54ccaa2da6912395962 (diff) | |
download | nextcloud-server-018d07b3e55fd7234008c51d0a124b7b681a1a4f.tar.gz nextcloud-server-018d07b3e55fd7234008c51d0a124b7b681a1a4f.zip |
Add share dialog into share tab
Diffstat (limited to 'apps/files_sharing')
-rw-r--r-- | apps/files_sharing/appinfo/app.php | 13 | ||||
-rw-r--r-- | apps/files_sharing/js/share.js | 4 | ||||
-rw-r--r-- | apps/files_sharing/js/sharetabview.js | 38 |
3 files changed, 42 insertions, 13 deletions
diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php index 3049dc6a263..2bb872eaad6 100644 --- a/apps/files_sharing/appinfo/app.php +++ b/apps/files_sharing/appinfo/app.php @@ -54,9 +54,16 @@ $application->setupPropagation(); \OCP\Share::registerBackend('file', 'OC_Share_Backend_File'); \OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file'); -\OCP\Util::addScript('files_sharing', 'share'); -\OCP\Util::addScript('files_sharing', 'sharetabview'); -\OCP\Util::addScript('files_sharing', 'external'); +$eventDispatcher = \OC::$server->getEventDispatcher(); +$eventDispatcher->addListener( + 'OCA\Files::loadAdditionalScripts', + function() { + \OCP\Util::addScript('files_sharing', 'share'); + \OCP\Util::addScript('files_sharing', 'sharetabview'); + \OCP\Util::addScript('files_sharing', 'external'); + } +); + // \OCP\Util::addStyle('files_sharing', 'sharetabview'); \OC::$server->getActivityManager()->registerExtension(function() { diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index c124d390d04..a4ae7fad899 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -151,9 +151,7 @@ } }); - OC.addScript('files_sharing', 'sharetabview').done(function() { - fileList.registerTabView(new OCA.Sharing.ShareTabView('shareTabView')); - }); + fileList.registerTabView(new OCA.Sharing.ShareTabView('shareTabView')); }, /** diff --git a/apps/files_sharing/js/sharetabview.js b/apps/files_sharing/js/sharetabview.js index ee572b747ea..99a5a0fb1db 100644 --- a/apps/files_sharing/js/sharetabview.js +++ b/apps/files_sharing/js/sharetabview.js @@ -10,7 +10,10 @@ (function() { var TEMPLATE = - '<div><ul>{{#if owner}}<li>Owner: {{owner}}</li>{{/if}}</ul></div>'; + '<div>' + + '<ul>{{#if owner}}<li>Owner: {{owner}}</li>{{/if}}</ul>' + + '<div class="dialogContainer"></div>' + + '</div>'; /** * @memberof OCA.Sharing @@ -20,7 +23,12 @@ id: 'shareTabView', className: 'tab shareTabView', - _template: null, + template: function(params) { + if (!this._template) { + this._template = Handlebars.compile(TEMPLATE); + } + return this._template(params); + }, getLabel: function() { return t('files_sharing', 'Sharing'); @@ -30,10 +38,10 @@ * Renders this details view */ render: function() { - this.$el.empty(); - - if (!this._template) { - this._template = Handlebars.compile(TEMPLATE); + if (this._dialog) { + // remove/destroy older instance + this._dialog.remove(); + this._dialog = null; } if (this.model) { @@ -42,11 +50,27 @@ if (owner === OC.currentUser) { owner = null; } - this.$el.append(this._template({ + this.$el.html(this.template({ owner: owner })); + var attributes = { + itemType: 'file', + itemSource: this.model.get('id'), + // TODO: make these available + possiblePermissions: this.model.get('sharingPossiblePermissions') + }; + var shareModel = new OC.Share.ShareItemModel(attributes, {configModel: configModel}); + var configModel = new OC.Share.ShareConfigModel(); + this._dialog = new OC.Share.ShareDialogView({ + configModel: configModel, + model: shareModel + }); + this.$el.find('.dialogContainer').append(this._dialog.$el); + this._dialog.render(); + shareModel.fetch(); } else { + this.$el.empty(); // TODO: render placeholder text? } } |