Save dictionary options
This commit is contained in:
parent
20304b5460
commit
73c7c225f1
@ -91,6 +91,14 @@ function getFormValues() {
|
|||||||
optsNew.ankiKanjiModel = $('#anki-kanji-model').val();
|
optsNew.ankiKanjiModel = $('#anki-kanji-model').val();
|
||||||
optsNew.ankiKanjiFields = fieldsToDict($('#kanji .anki-field-value'));
|
optsNew.ankiKanjiFields = fieldsToDict($('#kanji .anki-field-value'));
|
||||||
|
|
||||||
|
$('.dictionary').each((index, element) => {
|
||||||
|
const dictionary = $(element);
|
||||||
|
const name = dictionary.data('name');
|
||||||
|
const enableTerms = dictionary.find('.dict-enable-terms').prop('checked');
|
||||||
|
const enableKanji = dictionary.find('.dict-enable-kanji').prop('checked');
|
||||||
|
optsNew.dictionaries[name] = {enableTerms, enableKanji};
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
optsNew: sanitizeOptions(optsNew),
|
optsNew: sanitizeOptions(optsNew),
|
||||||
optsOld: sanitizeOptions(optsOld)
|
optsOld: sanitizeOptions(optsOld)
|
||||||
@ -172,12 +180,14 @@ function populateDictionaries(opts) {
|
|||||||
|
|
||||||
container.append($(html));
|
container.append($(html));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
container.find('.dictionary input').change(onOptionsChanged);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function populateAnkiFields(element, opts) {
|
function populateAnkiFields(element, opts) {
|
||||||
const tab = element.closest('.tab-pane');
|
const tab = element.closest('.tab-pane');
|
||||||
const container = tab.find('.anki-fields tbody');
|
const container = tab.find('tbody');
|
||||||
container.empty();
|
container.empty();
|
||||||
|
|
||||||
const modelName = element.val();
|
const modelName = element.val();
|
||||||
|
@ -65,25 +65,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<h3>Dictionaries</h3>
|
<h3>Dictionaries</h3>
|
||||||
|
|
||||||
<div class="dictionaries">
|
<div class="dictionaries"></div>
|
||||||
<div class="dictionary well well-sm">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-xs-8">
|
|
||||||
<h4><span class="text-muted glyphicon glyphicon-book"></span> Dictionary <small>v.1</small></h4>
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-4 text-right">
|
|
||||||
<button type="button" class="dict-delete btn btn-danger">Delete</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="checkbox">
|
|
||||||
<label><input type="checkbox" class="dict-enable-terms"> Enable term search</label>
|
|
||||||
</div>
|
|
||||||
<div class="checkbox">
|
|
||||||
<label><input type="checkbox" class="dict-enable-kanji"> Enable Kanji search</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="alert alert-danger" id="dict-error">
|
<div class="alert alert-danger" id="dict-error">
|
||||||
<strong>Error:</strong>
|
<strong>Error:</strong>
|
||||||
|
Loading…
Reference in New Issue
Block a user