Settings controller changes (#990)

* Make allowSecondarySearchesCheckbox optional

* Move getDictionaryInfo into SettingsController
This commit is contained in:
toasted-nutbread 2020-11-05 18:45:57 -05:00 committed by GitHub
parent 5b9d709d40
commit 3216a9e263
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -70,8 +70,10 @@ class DictionaryEntry {
if (detailsToggleLink !== null) { detailsToggleLink.hidden = !hasDetails; } if (detailsToggleLink !== null) { detailsToggleLink.hidden = !hasDetails; }
enabledCheckbox.dataset.setting = ObjectPropertyAccessor.getPathString(['dictionaries', title, 'enabled']); enabledCheckbox.dataset.setting = ObjectPropertyAccessor.getPathString(['dictionaries', title, 'enabled']);
allowSecondarySearchesCheckbox.dataset.setting = ObjectPropertyAccessor.getPathString(['dictionaries', title, 'allowSecondarySearches']);
priorityInput.dataset.setting = ObjectPropertyAccessor.getPathString(['dictionaries', title, 'priority']); priorityInput.dataset.setting = ObjectPropertyAccessor.getPathString(['dictionaries', title, 'priority']);
if (allowSecondarySearchesCheckbox !== null) {
allowSecondarySearchesCheckbox.dataset.setting = ObjectPropertyAccessor.getPathString(['dictionaries', title, 'allowSecondarySearches']);
}
if (deleteButton !== null) { if (deleteButton !== null) {
this._eventListeners.addEventListener(deleteButton, 'click', this._onDeleteButtonClicked.bind(this), false); this._eventListeners.addEventListener(deleteButton, 'click', this._onDeleteButtonClicked.bind(this), false);
@ -235,7 +237,7 @@ class DictionaryController {
const token = {}; const token = {};
this._databaseStateToken = token; this._databaseStateToken = token;
this._dictionaries = null; this._dictionaries = null;
const dictionaries = await api.getDictionaryInfo(); const dictionaries = await this._settingsController.getDictionaryInfo();
if (this._databaseStateToken !== token) { return; } if (this._databaseStateToken !== token) { return; }
this._dictionaries = dictionaries; this._dictionaries = dictionaries;

View File

@ -98,6 +98,10 @@ class SettingsController extends EventDispatcher {
return await this.modifyProfileSettings([{action: 'set', path, value}]); return await this.modifyProfileSettings([{action: 'set', path, value}]);
} }
async getDictionaryInfo() {
return await api.getDictionaryInfo();
}
getOptionsContext() { getOptionsContext() {
return {index: this._profileIndex}; return {index: this._profileIndex};
} }