mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-25 02:44:18 +00:00
Delete condition logic in token builder
This commit is contained in:
parent
0882e085a3
commit
6559051fd5
@ -102,36 +102,12 @@ nopaque.corpus_analysis.query_builder.TokenAttributeBuilderFunctions = class Tok
|
|||||||
notSelectedButton.parentNode.removeChild(notSelectedButton);
|
notSelectedButton.parentNode.removeChild(notSelectedButton);
|
||||||
this.elements.tokenQuery.appendChild(tokenQueryTemplateClone);
|
this.elements.tokenQuery.appendChild(tokenQueryTemplateClone);
|
||||||
|
|
||||||
// Deleting the options which do not make sense in the context of the condition like "word" AND "word". Also sets selection default.
|
|
||||||
let selectionDefault = "word";
|
|
||||||
let optionDeleteList = ['empty-token'];
|
|
||||||
if (conditionText === 'and') {
|
|
||||||
switch (this.elements.positionalAttrSelection.value) {
|
|
||||||
case 'english-pos' || 'german-pos':
|
|
||||||
optionDeleteList.push('english-pos', 'german-pos');
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
optionDeleteList.push(this.elements.positionalAttrSelection.value);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
let originalSelectionList =
|
|
||||||
`
|
|
||||||
<option value="word" selected>word</option>
|
|
||||||
<option value="lemma" >lemma</option>
|
|
||||||
<option value="english-pos">english pos</option>
|
|
||||||
<option value="german-pos">german pos</option>
|
|
||||||
<option value="simple_pos">simple_pos</option>
|
|
||||||
`;
|
|
||||||
this.elements.positionalAttrSelection.innerHTML = originalSelectionList;
|
|
||||||
M.FormSelect.init(this.elements.positionalAttrSelection);
|
|
||||||
}
|
|
||||||
let lastTokenQueryRow = this.elements.tokenQuery.lastElementChild;
|
let lastTokenQueryRow = this.elements.tokenQuery.lastElementChild;
|
||||||
if(lastTokenQueryRow.querySelector('[data-kind-of-token="word"]') || lastTokenQueryRow.querySelector('[data-kind-of-token="lemma"]')) {
|
if(lastTokenQueryRow.querySelector('[data-kind-of-token="word"]') || lastTokenQueryRow.querySelector('[data-kind-of-token="lemma"]')) {
|
||||||
this.appendIgnoreCaseCheckbox(lastTokenQueryRow.querySelector('.token-query-template-content'), this.elements.ignoreCaseCheckbox.checked);
|
this.appendIgnoreCaseCheckbox(lastTokenQueryRow.querySelector('.token-query-template-content'), this.elements.ignoreCaseCheckbox.checked);
|
||||||
}
|
}
|
||||||
this.elements.ignoreCaseCheckbox.checked = false;
|
this.elements.ignoreCaseCheckbox.checked = false;
|
||||||
this.setTokenSelection(selectionDefault, optionDeleteList);
|
this.setTokenSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteTokenQueryRow(deleteButton) {
|
deleteTokenQueryRow(deleteButton) {
|
||||||
@ -169,7 +145,7 @@ nopaque.corpus_analysis.query_builder.TokenAttributeBuilderFunctions = class Tok
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setTokenSelection(selection, optionDeleteList) {
|
setTokenSelection(selection="word", optionDeleteList=['empty-token']) {
|
||||||
optionDeleteList.forEach(option => {
|
optionDeleteList.forEach(option => {
|
||||||
if (this.elements.positionalAttrSelection.querySelector(`option[value=${option}]`) !== null) {
|
if (this.elements.positionalAttrSelection.querySelector(`option[value=${option}]`) !== null) {
|
||||||
this.elements.positionalAttrSelection.querySelector(`option[value=${option}]`).remove();
|
this.elements.positionalAttrSelection.querySelector(`option[value=${option}]`).remove();
|
||||||
|
Loading…
Reference in New Issue
Block a user