summaryrefslogtreecommitdiff
path: root/ext/bg/js/options-form.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-11-08 21:02:12 -0800
committerAlex Yatskov <alex@foosoft.net>2016-11-08 21:02:12 -0800
commit1b1f4a3ed7eaf29379be576e31ec4116347c6140 (patch)
tree46ab927041fc959a19b93d9079d27f5cf74a07f6 /ext/bg/js/options-form.js
parentdeb4ef52bafdc6b698ab1ea34239125a61f4cd23 (diff)
WIP
Diffstat (limited to 'ext/bg/js/options-form.js')
-rw-r--r--ext/bg/js/options-form.js23
1 files changed, 14 insertions, 9 deletions
diff --git a/ext/bg/js/options-form.js b/ext/bg/js/options-form.js
index 808aa941..1fcd0838 100644
--- a/ext/bg/js/options-form.js
+++ b/ext/bg/js/options-form.js
@@ -150,8 +150,7 @@ function populateDictionaries(opts) {
}
function onDictionaryDelete() {
- const dictDelete = $(this);
- dictDelete.prop('disabled', true);
+ const dictGroup = $(this).closest('.dict-group');
const dictError = $('#dict-error');
dictError.hide();
@@ -159,14 +158,20 @@ function onDictionaryDelete() {
const dictSpinner = $('#dict-spinner');
dictSpinner.show();
- const dictGroup = dictDelete.closest('.dict-group');
+ const dictProgress = dictGroup.find('.dict-delete-progress');
+ dictProgress.show();
+
+ const dictControls = dictGroup.find('.dict-controls');
+ dictControls.hide();
+
database().deleteDictionary(dictGroup.data('title')).then(() => {
dictGroup.slideUp();
}).catch(error => {
dictError.show().find('span').text(error);
- dictDelete.prop('disabled', false);
}).then(() => {
dictSpinner.hide();
+ dictProgress.hide();
+ dictControls.show();
});
}
@@ -177,14 +182,14 @@ function onDictionaryImport() {
const dictError = $('#dict-error');
dictError.hide();
+ const dictProgress = $('#dict-import-progress');
+ dictProgress.show();
+
const dictSpinner = $('#dict-spinner');
dictSpinner.show();
- const progressbar = $('#dict-import-progress');
- progressbar.show();
-
const callback = (total, current) => {
- progressbar.find('div').css('width', `${current / total * 100.0}%`);
+ dictProgress.find('div').css('width', `${current / total * 100.0}%`);
};
const dictUrl = $('#dict-url');
@@ -196,7 +201,7 @@ function onDictionaryImport() {
dictImport.prop('disabled', false);
dictUrl.val('');
dictUrl.trigger('input');
- progressbar.hide();
+ dictProgress.hide();
dictSpinner.hide();
});
}