diff --git a/core/js/sharedialoglinkshareview.js b/core/js/sharedialoglinkshareview.js index ccd705803f..ca6413761b 100644 --- a/core/js/sharedialoglinkshareview.js +++ b/core/js/sharedialoglinkshareview.js @@ -14,32 +14,34 @@ } var TEMPLATE = - '' + '{{else}}' + + '' + + '{{/if}}' ; /** @@ -88,11 +90,17 @@ }, render: function() { + var linkShareTemplate = this.template(); + if( !this.model.hasSharePermission() || !this.showLink || !this.configModel.isShareWithLinkAllowed()) { this.$el.empty(); + this.$el.append(linkShareTemplate({ + shareAllowed: false, + noSharingPlaceholder: t('core', 'Resharing is not allowed') + })); return this; } @@ -106,9 +114,9 @@ publicUploadChecked = 'checked="checked"'; } - var linkShareTemplate = this.template(); this.$el.empty(); this.$el.append(linkShareTemplate({ + shareAllowed: true, linkShareLabel: t('core', 'Share link'), urlLabel: t('core', 'Link'), enablePasswordLabel: t('core', 'Password protect'), diff --git a/core/js/sharedialogview.js b/core/js/sharedialogview.js index b33130a83d..63c3473252 100644 --- a/core/js/sharedialogview.js +++ b/core/js/sharedialogview.js @@ -24,11 +24,7 @@ '{{{remoteShareInfo}}}' + '' + - '{{#if shareAllowed}}' + '
' + - '{{else}}' + - '{{{noSharing}}}' + - '{{/if}}' + '
' ; @@ -114,21 +110,17 @@ shareLabel: t('core', 'Share'), sharePlaceholder: this._renderSharePlaceholderPart(), remoteShareInfo: this._renderRemoteShareInfoPart(), - shareAllowed: this.model.hasSharePermission(), - noSharing: this._renderNoSharing(), })); this.resharerInfoView.$el = this.$el.find('.resharerInfoView'); this.resharerInfoView.render(); + this.linkShareView.$el = this.$el.find('.linkShareView'); + this.linkShareView.render(); + this.expirationView.$el = this.$el.find('.expirationView'); this.expirationView.render(); - if(this.model.hasSharePermission()) { - this.linkShareView.$el = this.$el.find('.linkShareView'); - this.linkShareView.render(); - } - this.$el.find('.hasTooltip').tooltip(); if(this.configModel.areAvatarsEnabled()) { this.$el.find('.avatar').avatar(this.model.getReshareOwner, 32); @@ -169,17 +161,6 @@ return sharePlaceholder; }, - _renderNoSharing: function () { - var noSharing = ''; - if(!this.model.hasSharePermission()) { - var noSharingTemplate = this._getTemplate('noSharing', TEMPLATE_NO_SHARING); - noSharing = noSharingTemplate({ - placeholder: t('core', 'Resharing is not allowed') - }); - } - return noSharing; - }, - /** * * @param {string} key - an identifier for the template