summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-02-15 10:45:42 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-02-15 10:45:42 +0100
commit2054dbd4c886e8f4d3fcd02f95bab78fb88cc917 (patch)
treebaa458851c593dcf06c346a59a281169ac74945c
parentbe34cea970b9953ba70ddcec296ad48cd36df797 (diff)
parent92c131b481b675907881af1b6a1d33f4191ee809 (diff)
downloadnextcloud-server-2054dbd4c886e8f4d3fcd02f95bab78fb88cc917.tar.gz
nextcloud-server-2054dbd4c886e8f4d3fcd02f95bab78fb88cc917.zip
Merge pull request #22350 from owncloud/fix_22304
WebUI feedback when sharing
-rw-r--r--core/js/sharedialogview.js14
-rw-r--r--core/js/shareitemmodel.js8
-rw-r--r--core/js/tests/specs/sharedialogviewSpec.js16
3 files changed, 30 insertions, 8 deletions
diff --git a/core/js/sharedialogview.js b/core/js/sharedialogview.js
index 225c9bffd62..857d1407ab4 100644
--- a/core/js/sharedialogview.js
+++ b/core/js/sharedialogview.js
@@ -263,8 +263,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) {
diff --git a/core/js/tests/specs/sharedialogviewSpec.js b/core/js/tests/specs/sharedialogviewSpec.js
index 6899e625c45..3a94379789a 100644
--- a/core/js/tests/specs/sharedialogviewSpec.js
+++ b/core/js/tests/specs/sharedialogviewSpec.js
@@ -956,9 +956,12 @@ describe('OC.Share.ShareDialogView', function() {
it('calls addShare after selection', function() {
dialog.render();
+
+ var shareWith = $('.shareWithField')[0];
+ var $shareWith = $(shareWith);
var addShareStub = sinon.stub(shareModel, 'addShare');
var autocompleteOptions = autocompleteStub.getCall(0).args[0];
- autocompleteOptions.select(new $.Event('select'), {
+ autocompleteOptions.select(new $.Event('select', {target: shareWith}), {
item: {
label: 'User Two',
value: {
@@ -974,6 +977,17 @@ describe('OC.Share.ShareDialogView', function() {
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();
});
});