Merge pull request #22350 from owncloud/fix_22304
WebUI feedback when sharing
This commit is contained in:
commit
2054dbd4c8
|
@ -263,8 +263,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) {
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -956,9 +956,12 @@ describe('OC.Share.ShareDialogView', function() {
|
||||||
|
|
||||||
it('calls addShare after selection', function() {
|
it('calls addShare after selection', function() {
|
||||||
dialog.render();
|
dialog.render();
|
||||||
|
|
||||||
|
var shareWith = $('.shareWithField')[0];
|
||||||
|
var $shareWith = $(shareWith);
|
||||||
var addShareStub = sinon.stub(shareModel, 'addShare');
|
var addShareStub = sinon.stub(shareModel, 'addShare');
|
||||||
var autocompleteOptions = autocompleteStub.getCall(0).args[0];
|
var autocompleteOptions = autocompleteStub.getCall(0).args[0];
|
||||||
autocompleteOptions.select(new $.Event('select'), {
|
autocompleteOptions.select(new $.Event('select', {target: shareWith}), {
|
||||||
item: {
|
item: {
|
||||||
label: 'User Two',
|
label: 'User Two',
|
||||||
value: {
|
value: {
|
||||||
|
@ -974,6 +977,17 @@ describe('OC.Share.ShareDialogView', function() {
|
||||||
shareWith: 'user2'
|
shareWith: 'user2'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Input is locked
|
||||||
|
expect($shareWith.val()).toEqual('User Two');
|
||||||
|
expect($shareWith.attr('disabled')).toEqual('disabled');
|
||||||
|
|
||||||
|
//Callback is called
|
||||||
|
addShareStub.firstCall.args[1].success();
|
||||||
|
|
||||||
|
//Input is unlocked
|
||||||
|
expect($shareWith.val()).toEqual('');
|
||||||
|
expect($shareWith.attr('disabled')).toEqual(undefined);
|
||||||
|
|
||||||
addShareStub.restore();
|
addShareStub.restore();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue