diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2015-09-14 01:01:02 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-09-16 07:23:28 +0200 |
commit | 7ae84e0e5c60a5b891dcc4183b0a1cff83f36090 (patch) | |
tree | 2de5afc2830862fd37688b0e52457ff1637c7199 | |
parent | 6d832359b6f00bed5b2444b8d3cd0680a459619e (diff) | |
download | nextcloud-server-7ae84e0e5c60a5b891dcc4183b0a1cff83f36090.tar.gz nextcloud-server-7ae84e0e5c60a5b891dcc4183b0a1cff83f36090.zip |
make 'Allow editing' (aka public upload) checkbox work
-rw-r--r-- | core/js/share.js | 40 | ||||
-rw-r--r-- | core/js/sharedialoglinkshareview.js | 10 | ||||
-rw-r--r-- | core/js/shareitemmodel.js | 9 |
3 files changed, 18 insertions, 41 deletions
diff --git a/core/js/share.js b/core/js/share.js index f97a91bd3ab..0157bcdba7c 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -956,46 +956,6 @@ $(document).ready(function() { permissions); }); - // Handle the Allow Public Upload Checkbox - $(document).on('click', '#sharingDialogAllowPublicUpload', function() { - - // Gather data - var $dropDown = $('#dropdown'); - var allowPublicUpload = $(this).is(':checked'); - var itemType = $dropDown.data('item-type'); - var itemSource = $dropDown.data('item-source'); - var itemSourceName = $dropDown.data('item-source-name'); - var expirationDate = ''; - if ($('#expirationCheckbox').is(':checked') === true) { - expirationDate = $( "#expirationDate" ).val(); - } - var permissions = 0; - var $button = $(this); - var $loading = $dropDown.find('#allowPublicUploadWrapper .icon-loading-small'); - - if (!$loading.hasClass('hidden')) { - // already in progress - return false; - } - - // Calculate permissions - if (allowPublicUpload) { - permissions = OC.PERMISSION_UPDATE + OC.PERMISSION_CREATE + OC.PERMISSION_READ; - } else { - permissions = OC.PERMISSION_READ; - } - - // Update the share information - $button.addClass('hidden'); - $button.prop('disabled', true); - $loading.removeClass('hidden'); - OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', permissions, itemSourceName, expirationDate, function(data) { - $loading.addClass('hidden'); - $button.removeClass('hidden'); - $button.prop('disabled', false); - }); - }); - $(document).on('click', '#dropdown #expirationCheckbox', function() { if (this.checked) { OC.Share.showExpirationDate(''); diff --git a/core/js/sharedialoglinkshareview.js b/core/js/sharedialoglinkshareview.js index 04ea41e5e00..f49a73f291b 100644 --- a/core/js/sharedialoglinkshareview.js +++ b/core/js/sharedialoglinkshareview.js @@ -94,7 +94,8 @@ throw 'missing OC.Share.ShareConfigModel'; } - _.bindAll(this, 'onLinkCheckBoxChange', 'onPasswordEntered', 'onShowPasswordClick'); + _.bindAll(this, 'onLinkCheckBoxChange', 'onPasswordEntered', + 'onShowPasswordClick', 'onAllowPublicUploadChange'); }, onLinkCheckBoxChange: function() { @@ -149,6 +150,12 @@ this.model.addLinkShare({password: password}); }, + onAllowPublicUploadChange: function() { + this.$el.find('#sharingDialogAllowPublicUpload') + .siblings('.icon-loading-small').removeClass('hidden').addClass('inlineblock'); + this.model.setPublicUpload(this.$el.find('#sharingDialogAllowPublicUpload').is(':checked')); + }, + render: function() { var linkShareTemplate = this.template(); @@ -199,6 +206,7 @@ })); this.$el.find('#linkCheckbox').change(this.onLinkCheckBoxChange); + this.$el.find('#sharingDialogAllowPublicUpload').change(this.onAllowPublicUploadChange); this.$el.find('#linkText').click(this.onLinkTextClick); this.$el.find('#showPassword').click(this.onShowPasswordClick); this.$el.find('#linkPassText').focusout(this.onPasswordEntered); diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js index 9e3f829e457..3569c6ffd1a 100644 --- a/core/js/shareitemmodel.js +++ b/core/js/shareitemmodel.js @@ -132,6 +132,15 @@ }); }, + setPublicUpload: function(allow) { + var permissions = OC.PERMISSION_READ; + if(allow) { + permissions = OC.PERMISSION_UPDATE + OC.PERMISSION_CREATE + OC.PERMISSION_READ; + } + + this.addLinkShare({permissions: permissions}); + }, + addShare: function(event, selected, options) { event.preventDefault(); |