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.
This commit is contained in:
Roeland Jago Douma 2016-02-12 14:01:15 +01:00
parent f8607ac132
commit 51b55d5320
2 changed files with 15 additions and 7 deletions

View File

@ -233,8 +233,18 @@
_onSelectRecipient: function(e, s) { _onSelectRecipient: function(e, s) {
e.preventDefault(); e.preventDefault();
$(e.target).val(''); $(e.target).attr('disabled', true)
this.model.addShare(s.item.value); .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) { _toggleLoading: function(state) {

View File

@ -183,11 +183,9 @@
data: attributes, data: attributes,
dataType: 'json' dataType: 'json'
}).done(function() { }).done(function() {
self.fetch({ self.fetch().done(function() {
success: function() { if (_.isFunction(options.success)) {
if (_.isFunction(options.success)) { options.success(self);
options.success(self);
}
} }
}); });
}).fail(function(xhr) { }).fail(function(xhr) {