summaryrefslogtreecommitdiffstats
path: root/core/js
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2018-03-20 13:44:28 +0100
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2018-03-21 04:35:23 +0100
commita2c52cd6a513d697a888687db5842265af726d60 (patch)
treef78429a5879de1207367894f49c723cb0f2215e8 /core/js
parent9a0fbe307d1eb8583117e5c38ec1f4ae2b5e0f9a (diff)
downloadnextcloud-server-a2c52cd6a513d697a888687db5842265af726d60.tar.gz
nextcloud-server-a2c52cd6a513d697a888687db5842265af726d60.zip
Extract code to restore the UI after confirming a share
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'core/js')
-rw-r--r--core/js/sharedialogview.js45
1 files changed, 15 insertions, 30 deletions
diff --git a/core/js/sharedialogview.js b/core/js/sharedialogview.js
index 21fb03c7b05..0b36db65116 100644
--- a/core/js/sharedialogview.js
+++ b/core/js/sharedialogview.js
@@ -484,6 +484,15 @@
$shareWithField.autocomplete('close');
$shareWithField.autocomplete('disable');
+ var restoreUI = function() {
+ $loading.addClass('hidden');
+ $loading.removeClass('inlineblock');
+ $confirm.removeClass('hidden');
+
+ $shareWithField.prop('disabled', false);
+ $shareWithField.focus();
+ };
+
var perPage = 200;
var onlyExactMatches = true;
this._getSuggestions(
@@ -493,12 +502,7 @@
onlyExactMatches
).done(function(suggestions, exactMatches) {
if (suggestions.length === 0) {
- $loading.addClass('hidden');
- $loading.removeClass('inlineblock');
- $confirm.removeClass('hidden');
-
- $shareWithField.prop('disabled', false);
- $shareWithField.focus();
+ restoreUI();
$shareWithField.autocomplete('enable');
@@ -511,12 +515,7 @@
}
if (exactMatches.length !== 1) {
- $loading.addClass('hidden');
- $loading.removeClass('inlineblock');
- $confirm.removeClass('hidden');
-
- $shareWithField.prop('disabled', false);
- $shareWithField.focus();
+ restoreUI();
$shareWithField.autocomplete('enable');
@@ -524,27 +523,18 @@
}
var actionSuccess = function() {
- $loading.addClass('hidden');
- $loading.removeClass('inlineblock');
- $confirm.removeClass('hidden');
-
// Adding a share changes the suggestions.
self._lastSuggestions = undefined;
$shareWithField.val('');
- $shareWithField.prop('disabled', false);
- $shareWithField.focus();
+
+ restoreUI();
$shareWithField.autocomplete('enable');
};
var actionError = function(obj, msg) {
- $loading.addClass('hidden');
- $loading.removeClass('inlineblock');
- $confirm.removeClass('hidden');
-
- $shareWithField.prop('disabled', false);
- $shareWithField.focus();
+ restoreUI();
$shareWithField.autocomplete('enable');
@@ -556,12 +546,7 @@
error: actionError
});
}).fail(function(message) {
- $loading.addClass('hidden');
- $loading.removeClass('inlineblock');
- $confirm.removeClass('hidden');
-
- $shareWithField.prop('disabled', false);
- $shareWithField.focus();
+ restoreUI();
$shareWithField.autocomplete('enable');