Change "Allow Duplicates" to "Prevent Duplicates"
This commit is contained in:
parent
c86dfb06b6
commit
80e9a06235
|
@ -197,13 +197,13 @@
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="editSettingsTab" style="display:none;">
|
<section id="editSettingsTab" style="display:none;">
|
||||||
<label>Allow Duplicate Words
|
<label>Prevent Duplicate Words
|
||||||
<input type="checkbox" id="editAllowDuplicates"><br>
|
<input type="checkbox" id="editPreventDuplicates"><br>
|
||||||
<small>Checking this box will allow any number of the exact same spelling of a word to be added</small>
|
<small>Checking this box will prevent the creation of words with the exact same spelling.</small>
|
||||||
</label>
|
</label>
|
||||||
<label>Words are Case-Sensitive
|
<label>Words are Case-Sensitive
|
||||||
<input type="checkbox" id="editCaseSensitive"><br>
|
<input type="checkbox" id="editCaseSensitive"><br>
|
||||||
<small>Checking this box will allow any words spelled the same but with different capitalization to be added.</small>
|
<small>Checking this box will allow the creation of words with the exact same spelling if their capitalization is different.</small>
|
||||||
</label>
|
</label>
|
||||||
<label>Sort by Definition
|
<label>Sort by Definition
|
||||||
<input type="checkbox" id="editSortByDefinition"><br>
|
<input type="checkbox" id="editSortByDefinition"><br>
|
||||||
|
|
|
@ -28,8 +28,9 @@ export function openEditModal() {
|
||||||
document.getElementById('editOrthography').value = orthography.notes;
|
document.getElementById('editOrthography').value = orthography.notes;
|
||||||
document.getElementById('editGrammar').value = grammar.notes;
|
document.getElementById('editGrammar').value = grammar.notes;
|
||||||
|
|
||||||
document.getElementById('editAllowDuplicates').checked = allowDuplicates;
|
document.getElementById('editPreventDuplicates').checked = !allowDuplicates;
|
||||||
document.getElementById('editCaseSensitive').checked = caseSensitive;
|
document.getElementById('editCaseSensitive').checked = caseSensitive;
|
||||||
|
if (allowDuplicates) document.getElementById('editCaseSensitive').disabled = true;
|
||||||
document.getElementById('editSortByDefinition').checked = sortByDefinition;
|
document.getElementById('editSortByDefinition').checked = sortByDefinition;
|
||||||
document.getElementById('editIsComplete').checked = isComplete;
|
document.getElementById('editIsComplete').checked = isComplete;
|
||||||
document.getElementById('editIsPublic').checked = isPublic;
|
document.getElementById('editIsPublic').checked = isPublic;
|
||||||
|
@ -54,7 +55,7 @@ export function save() {
|
||||||
window.currentDictionary.details.orthography.notes = removeTags(document.getElementById('editOrthography').value.trim());
|
window.currentDictionary.details.orthography.notes = removeTags(document.getElementById('editOrthography').value.trim());
|
||||||
window.currentDictionary.details.grammar.notes = removeTags(document.getElementById('editGrammar').value.trim());
|
window.currentDictionary.details.grammar.notes = removeTags(document.getElementById('editGrammar').value.trim());
|
||||||
|
|
||||||
window.currentDictionary.settings.allowDuplicates = document.getElementById('editAllowDuplicates').checked;
|
window.currentDictionary.settings.allowDuplicates = !document.getElementById('editPreventDuplicates').checked;
|
||||||
window.currentDictionary.settings.caseSensitive = document.getElementById('editCaseSensitive').checked;
|
window.currentDictionary.settings.caseSensitive = document.getElementById('editCaseSensitive').checked;
|
||||||
window.currentDictionary.settings.sortByDefinition = document.getElementById('editSortByDefinition').checked;
|
window.currentDictionary.settings.sortByDefinition = document.getElementById('editSortByDefinition').checked;
|
||||||
window.currentDictionary.settings.isComplete = document.getElementById('editIsComplete').checked;
|
window.currentDictionary.settings.isComplete = document.getElementById('editIsComplete').checked;
|
||||||
|
|
|
@ -35,6 +35,7 @@ function setupDetailsTabs() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
setupEditFormTabs();
|
setupEditFormTabs();
|
||||||
|
setupEditFormInteractions();
|
||||||
setupEditFormButtons();
|
setupEditFormButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,6 +53,22 @@ function setupEditFormTabs() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setupEditFormInteractions() {
|
||||||
|
const preventDuplicatesBox = document.getElementById('editPreventDuplicates');
|
||||||
|
preventDuplicatesBox.addEventListener('change', () => {
|
||||||
|
console.log('changed');
|
||||||
|
const caseSensitiveBox = document.getElementById('editCaseSensitive');
|
||||||
|
if (preventDuplicatesBox.checked) {
|
||||||
|
console.log('checked');
|
||||||
|
caseSensitiveBox.disabled = false;
|
||||||
|
} else {
|
||||||
|
console.log('unchecked');
|
||||||
|
caseSensitiveBox.disabled = true;
|
||||||
|
caseSensitiveBox.checked = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function setupEditFormButtons() {
|
function setupEditFormButtons() {
|
||||||
document.getElementById('editSave').addEventListener('click', () => save());
|
document.getElementById('editSave').addEventListener('click', () => save());
|
||||||
document.getElementById('editSaveAndClose').addEventListener('click', () => saveAndClose());
|
document.getElementById('editSaveAndClose').addEventListener('click', () => saveAndClose());
|
||||||
|
|
Loading…
Reference in New Issue