This commit is contained in:
Alex Yatskov 2016-11-07 22:16:00 -08:00
parent 638fe54c2a
commit f2f7b7f3db

View File

@ -153,6 +153,9 @@ function onDictionaryDelete() {
const dictDelete = $(this); const dictDelete = $(this);
dictDelete.prop('disabled', true); dictDelete.prop('disabled', true);
const dictError = $('#dict-error');
dictError.hide();
const dictGroup = dictDelete.closest('.dict-group'); const dictGroup = dictDelete.closest('.dict-group');
database().deleteDictionary(dictGroup.data('title')).then(() => { database().deleteDictionary(dictGroup.data('title')).then(() => {
dictGroup.slideUp(); dictGroup.slideUp();
@ -176,11 +179,13 @@ function onDictionaryImport() {
progressbar.find('div').css('width', `${current / total * 100.0}%`); progressbar.find('div').css('width', `${current / total * 100.0}%`);
}; };
database().importDictionary($('#dict-url').val(), callback).then(() => { const dictUrl = $('#dict-url');
database().importDictionary(dictUrl.val(), callback).then(() => {
return loadOptions().then(opts => populateDictionaries(opts)); return loadOptions().then(opts => populateDictionaries(opts));
}).catch(error => { }).catch(error => {
dictError.show().find('span').text(error); dictError.show().find('span').text(error);
}).then(() => { }).then(() => {
dictUrl.val('');
progressbar.hide(); progressbar.hide();
dictImport.prop('disabled', false); dictImport.prop('disabled', false);
}); });