diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2015-09-12 14:21:14 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-09-16 07:23:27 +0200 |
commit | f29b51682bc0be785e1a3e4e5901db3255e4a377 (patch) | |
tree | 93375423f13d63a4ca97cc800b8fb981d48432f5 /core/js/sharedialoglinkshareview.js | |
parent | 4c702aa8fdfb28bea4b021e55e7df5eeeb6999d2 (diff) | |
download | nextcloud-server-f29b51682bc0be785e1a3e4e5901db3255e4a377.tar.gz nextcloud-server-f29b51682bc0be785e1a3e4e5901db3255e4a377.zip |
share and unshare via link (not yet password). also some internal changes to reduce unnecessary rendering
Diffstat (limited to 'core/js/sharedialoglinkshareview.js')
-rw-r--r-- | core/js/sharedialoglinkshareview.js | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/core/js/sharedialoglinkshareview.js b/core/js/sharedialoglinkshareview.js index 373d6d180bc..b94f1c3e70b 100644 --- a/core/js/sharedialoglinkshareview.js +++ b/core/js/sharedialoglinkshareview.js @@ -23,13 +23,11 @@ ' {{#if showPasswordCheckBox}}' + '<input type="checkbox" name="showPassword" id="showPassword" {{#if isPasswordSet}}checked="checked"{{/if}} value="1" /><label for="showPassword">{{enablePasswordLabel}}</label>' + ' {{/if}}' + - ' {{#if isPasswordSet}}' + - '<div id="linkPass">' + + '<div id="linkPass" {{#unless isPasswordSet}}class="hidden"{{/unless}}>' + ' <label for="linkPassText" class="hidden-visually">{{passwordLabel}}</label>' + ' <input id="linkPassText" type="password" placeholder="{{passwordPlaceholder}}" />' + ' <span class="icon-loading-small hidden"></span>' + '</div>' + - ' {{/if}}' + ' {{#if publicUpload}}' + '<div id="allowPublicUploadWrapper" class="hidden">' + ' <span class="icon-loading-small hidden"></span>' + @@ -86,11 +84,42 @@ view.render(); }); + this.model.on('change:linkShare', function() { + view.render(); + }); + if(!_.isUndefined(options.configModel)) { this.configModel = options.configModel; } else { throw 'missing OC.Share.ShareConfigModel'; } + + _.bindAll(this, 'onLinkCheckBoxChange'); + }, + + onLinkCheckBoxChange: function() { + var $checkBox = this.$el.find('#linkCheckbox'); + var $loading = $checkBox.siblings('.icon-loading-small'); + if(!$loading.hasClass('hidden')) { + return false; + } + + if($checkBox.is(':checked')) { + if(this.configModel.get('enforcePasswordForPublicLink') === false) { + $loading.removeClass('hidden'); + this.model.addLinkShare(); + } else { + this.$el.find('#linkPass').slideToggle(OC.menuSpeed); + // TODO drop with IE8 drop + if($('html').hasClass('ie8')) { + this.$el.find('#linkPassText').attr('placeholder', null); + this.$el.find('#linkPassText').val(''); + } + this.$el.find('#linkPassText').focus(); + } + } else { + this.model.removeLinkShare(); + } }, render: function() { @@ -142,6 +171,8 @@ mailButtonText: t('core', 'Send') })); + this.$el.find('#linkCheckbox').change(this.onLinkCheckBoxChange); + return this; }, |