From 018d07b3e55fd7234008c51d0a124b7b681a1a4f Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 24 Aug 2015 13:00:03 +0200 Subject: Add share dialog into share tab --- apps/files_sharing/js/share.js | 4 +--- apps/files_sharing/js/sharetabview.js | 38 ++++++++++++++++++++++++++++------- 2 files changed, 32 insertions(+), 10 deletions(-) (limited to 'apps/files_sharing/js') 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 = - '
'; + '
' + + '' + + '
' + + '
'; /** * @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? } } -- cgit v1.2.3 From f709022559d434612f995ecce56a65b034590f6b Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 24 Aug 2015 13:15:33 +0200 Subject: Fix share permissions for share tab --- apps/files_sharing/js/sharetabview.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'apps/files_sharing/js') diff --git a/apps/files_sharing/js/sharetabview.js b/apps/files_sharing/js/sharetabview.js index 99a5a0fb1db..11f25c0c47c 100644 --- a/apps/files_sharing/js/sharetabview.js +++ b/apps/files_sharing/js/sharetabview.js @@ -57,8 +57,7 @@ var attributes = { itemType: 'file', itemSource: this.model.get('id'), - // TODO: make these available - possiblePermissions: this.model.get('sharingPossiblePermissions') + possiblePermissions: this.model.get('sharePermissions') }; var shareModel = new OC.Share.ShareItemModel(attributes, {configModel: configModel}); var configModel = new OC.Share.ShareConfigModel(); -- cgit v1.2.3 From ce1b0c650e3a0e4cb701609ee08a13182909219a Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Thu, 3 Sep 2015 15:53:17 +0200 Subject: show link share --- apps/files_sharing/js/sharetabview.js | 6 ++-- core/css/share.css | 4 --- core/js/shareconfigmodel.js | 3 +- core/js/sharedialogexpirationview.js | 10 ++++-- core/js/sharedialoglinkshareview.js | 32 ++++++++++++++------ core/js/shareitemmodel.js | 57 +++++++++++++++++++++++++++++++++-- 6 files changed, 92 insertions(+), 20 deletions(-) (limited to 'apps/files_sharing/js') diff --git a/apps/files_sharing/js/sharetabview.js b/apps/files_sharing/js/sharetabview.js index 11f25c0c47c..6836107306a 100644 --- a/apps/files_sharing/js/sharetabview.js +++ b/apps/files_sharing/js/sharetabview.js @@ -45,7 +45,6 @@ } if (this.model) { - console.log(this.model); var owner = this.model.get('shareOwner'); if (owner === OC.currentUser) { owner = null; @@ -59,8 +58,11 @@ itemSource: this.model.get('id'), possiblePermissions: this.model.get('sharePermissions') }; - var shareModel = new OC.Share.ShareItemModel(attributes, {configModel: configModel}); var configModel = new OC.Share.ShareConfigModel(); + var shareModel = new OC.Share.ShareItemModel(attributes, { + configModel: configModel, + fileInfoModel: this.model + }); this._dialog = new OC.Share.ShareDialogView({ configModel: configModel, model: shareModel diff --git a/core/css/share.css b/core/css/share.css index 0d687cb76da..bdf34e9a863 100644 --- a/core/css/share.css +++ b/core/css/share.css @@ -126,10 +126,6 @@ a.unshare { margin-right: 0; } -#linkText,#linkPass,#expiration { - display:none; -} - #link #showPassword img { padding-left:5px; width:12px; diff --git a/core/js/shareconfigmodel.js b/core/js/shareconfigmodel.js index e948c57cbac..846b2692ecb 100644 --- a/core/js/shareconfigmodel.js +++ b/core/js/shareconfigmodel.js @@ -16,7 +16,8 @@ var ShareConfigModel = OC.Backbone.Model.extend({ defaults: { - publicUploadEnabled: false + publicUploadEnabled: false, + enforcePasswordForPublicLink: oc_appconfig.core.enforcePasswordForPublicLink }, /** diff --git a/core/js/sharedialogexpirationview.js b/core/js/sharedialogexpirationview.js index 4c628f5498a..9fb404a090e 100644 --- a/core/js/sharedialogexpirationview.js +++ b/core/js/sharedialogexpirationview.js @@ -14,11 +14,14 @@ } var TEMPLATE = + // well that could go to linkShareView… + '{{#if isLinkShare}}' + '' + '' + '' + '' + - '{{defaultExpireMessage}}' + '{{defaultExpireMessage}}' + + '{{/if}}' ; /** @@ -44,6 +47,8 @@ /** @type {boolean} **/ showLink: true, + className: 'hidden', + initialize: function(options) { if(!_.isUndefined(options.configModel)) { this.configModel = options.configModel; @@ -68,7 +73,8 @@ setExpirationLabel: t('core', 'Set expiration date'), expirationLabel: t('core', 'Expiration'), expirationDatePlaceholder: t('core', 'Expiration date'), - defaultExpireMessage: defaultExpireMessage + defaultExpireMessage: defaultExpireMessage, + isLinkShare: this.model.get('linkShare').isLinkShare })); return this; diff --git a/core/js/sharedialoglinkshareview.js b/core/js/sharedialoglinkshareview.js index eebf8a34247..373d6d180bc 100644 --- a/core/js/sharedialoglinkshareview.js +++ b/core/js/sharedialoglinkshareview.js @@ -16,16 +16,20 @@ var TEMPLATE = '{{#if shareAllowed}}' + '' + - '' + + '' + '
' + '' + - '' + - '' + + '' + + ' {{#if showPasswordCheckBox}}' + + '' + + ' {{/if}}' + + ' {{#if isPasswordSet}}' + '
' + ' ' + - ' ' + + ' ' + ' ' + '
' + + ' {{/if}}' + ' {{#if publicUpload}}' + '' + ' {{#if publicUpload}}' + - '