From 51b55d53206ec8731611e6a36bf8d7e3317a451a Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Fri, 12 Feb 2016 14:01:15 +0100 Subject: [PATCH] Provide proper feedback when creating a share in the webUI Fixes #22304 Creating a share is not instant (especially not for federated shares) so we should show that something is happening in the webUI properly. --- core/js/sharedialogview.js | 14 ++++++++++++-- core/js/shareitemmodel.js | 8 +++----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/core/js/sharedialogview.js b/core/js/sharedialogview.js index 4cebf7962e8..02e0e673caa 100644 --- a/core/js/sharedialogview.js +++ b/core/js/sharedialogview.js @@ -233,8 +233,18 @@ _onSelectRecipient: function(e, s) { e.preventDefault(); - $(e.target).val(''); - this.model.addShare(s.item.value); + $(e.target).attr('disabled', true) + .val(s.item.label); + var $loading = this.$el.find('.shareWithLoading'); + $loading.removeClass('hidden') + .addClass('inlineblock'); + + this.model.addShare(s.item.value, {success: function() { + $(e.target).val('') + .attr('disabled', false); + $loading.addClass('hidden') + .removeClass('inlineblock'); + }}); }, _toggleLoading: function(state) { diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js index a28bcac91cb..292230d26d5 100644 --- a/core/js/shareitemmodel.js +++ b/core/js/shareitemmodel.js @@ -183,11 +183,9 @@ data: attributes, dataType: 'json' }).done(function() { - self.fetch({ - success: function() { - if (_.isFunction(options.success)) { - options.success(self); - } + self.fetch().done(function() { + if (_.isFunction(options.success)) { + options.success(self); } }); }).fail(function(xhr) { -- 2.39.5