mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-14 16:55:42 +00:00
Erase meta data logic from struc attribute builder
This commit is contained in:
parent
d0fe4360bb
commit
4f24e9f9da
@ -10,9 +10,7 @@ nopaque.corpus_analysis.query_builder.ElementReferences = class ElementReference
|
|||||||
this.structuralAttrModal = M.Modal.getInstance(document.querySelector('#corpus-analysis-concordance-structural-attr-modal'));
|
this.structuralAttrModal = M.Modal.getInstance(document.querySelector('#corpus-analysis-concordance-structural-attr-modal'));
|
||||||
this.englishEntTypeSelection = document.querySelector('#corpus-analysis-concordance-english-ent-type-selection');
|
this.englishEntTypeSelection = document.querySelector('#corpus-analysis-concordance-english-ent-type-selection');
|
||||||
this.germanEntTypeSelection = document.querySelector('#corpus-analysis-concordance-german-ent-type-selection');
|
this.germanEntTypeSelection = document.querySelector('#corpus-analysis-concordance-german-ent-type-selection');
|
||||||
this.textAnnotationSelection = document.querySelector('#corpus-analysis-concordance-text-annotation-options');
|
|
||||||
this.textAnnotationInput = document.querySelector('#corpus-analysis-concordance-text-annotation-input');
|
|
||||||
|
|
||||||
// Token Attribute Builder Elements
|
// Token Attribute Builder Elements
|
||||||
this.positionalAttrModal = M.Modal.getInstance(document.querySelector('#corpus-analysis-concordance-positional-attr-modal'));
|
this.positionalAttrModal = M.Modal.getInstance(document.querySelector('#corpus-analysis-concordance-positional-attr-modal'));
|
||||||
this.positionalAttrSelection = document.querySelector('#corpus-analysis-concordance-positional-attr-selection');
|
this.positionalAttrSelection = document.querySelector('#corpus-analysis-concordance-positional-attr-selection');
|
||||||
|
@ -5,8 +5,6 @@ nopaque.corpus_analysis.query_builder.StructuralAttributeBuilderFunctions = clas
|
|||||||
|
|
||||||
this.structuralAttrModalEventlisteners();
|
this.structuralAttrModalEventlisteners();
|
||||||
|
|
||||||
document.querySelector('#corpus-analysis-concordance-text-annotation-submit').addEventListener('click', () => this.textAnnotationSubmitHandler());
|
|
||||||
|
|
||||||
this.elements.structuralAttrModal = M.Modal.init(
|
this.elements.structuralAttrModal = M.Modal.init(
|
||||||
document.querySelector('#corpus-analysis-concordance-structural-attr-modal'),
|
document.querySelector('#corpus-analysis-concordance-structural-attr-modal'),
|
||||||
{
|
{
|
||||||
@ -46,10 +44,7 @@ nopaque.corpus_analysis.query_builder.StructuralAttributeBuilderFunctions = clas
|
|||||||
|
|
||||||
resetStructuralAttrModal() {
|
resetStructuralAttrModal() {
|
||||||
this.app.resetMaterializeSelection([this.elements.englishEntTypeSelection, this.elements.germanEntTypeSelection]);
|
this.app.resetMaterializeSelection([this.elements.englishEntTypeSelection, this.elements.germanEntTypeSelection]);
|
||||||
this.app.resetMaterializeSelection([this.elements.textAnnotationSelection], 'address');
|
this.app.toggleClass(['entity-builder'], 'hide', 'add');
|
||||||
this.elements.textAnnotationInput.value = '';
|
|
||||||
|
|
||||||
this.app.toggleClass(['entity-builder', 'text-annotation-builder'], 'hide', 'add');
|
|
||||||
this.toggleEditingAreaStructuralAttrModal('remove');
|
this.toggleEditingAreaStructuralAttrModal('remove');
|
||||||
this.elements.editingModusOn = false;
|
this.elements.editingModusOn = false;
|
||||||
this.elements.editedQueryChipElementIndex = undefined;
|
this.elements.editedQueryChipElementIndex = undefined;
|
||||||
@ -64,11 +59,6 @@ nopaque.corpus_analysis.query_builder.StructuralAttributeBuilderFunctions = clas
|
|||||||
break;
|
break;
|
||||||
case 'entity':
|
case 'entity':
|
||||||
this.app.toggleClass(['entity-builder'], 'hide', 'toggle');
|
this.app.toggleClass(['entity-builder'], 'hide', 'toggle');
|
||||||
this.app.toggleClass(['text-annotation-builder'], 'hide', 'add');
|
|
||||||
break;
|
|
||||||
case 'meta-data':
|
|
||||||
this.app.toggleClass(['text-annotation-builder'], 'hide', 'toggle');
|
|
||||||
this.app.toggleClass(['entity-builder'], 'hide', 'add');
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -77,29 +67,7 @@ nopaque.corpus_analysis.query_builder.StructuralAttributeBuilderFunctions = clas
|
|||||||
|
|
||||||
toggleEditingAreaStructuralAttrModal(action) {
|
toggleEditingAreaStructuralAttrModal(action) {
|
||||||
// If the user edits a query chip element, the corresponding editing area is displayed and the other areas are hidden or disabled.
|
// If the user edits a query chip element, the corresponding editing area is displayed and the other areas are hidden or disabled.
|
||||||
this.app.toggleClass(['sentence-button', 'entity-button', 'text-annotation-button', 'any-type-entity-button'], 'disabled', action);
|
this.app.toggleClass(['sentence-button', 'entity-button', 'any-type-entity-button'], 'disabled', action);
|
||||||
}
|
|
||||||
|
|
||||||
textAnnotationSubmitHandler() {
|
|
||||||
let noValueMetadataMessage = document.querySelector('#corpus-analysis-concordance-no-value-metadata-message');
|
|
||||||
let textAnnotationSubmit = document.querySelector('#corpus-analysis-concordance-text-annotation-submit');
|
|
||||||
let textAnnotationInput = document.querySelector('#corpus-analysis-concordance-text-annotation-input');
|
|
||||||
let textAnnotationOptions = document.querySelector('#corpus-analysis-concordance-text-annotation-options');
|
|
||||||
|
|
||||||
if (textAnnotationInput.value === '') {
|
|
||||||
textAnnotationSubmit.classList.add('red');
|
|
||||||
noValueMetadataMessage.classList.remove('hide');
|
|
||||||
setTimeout(() => {
|
|
||||||
textAnnotationSubmit.classList.remove('red');
|
|
||||||
}, 500);
|
|
||||||
setTimeout(() => {
|
|
||||||
noValueMetadataMessage.classList.add('hide');
|
|
||||||
}, 3000);
|
|
||||||
} else {
|
|
||||||
let queryText = `:: match.text_${textAnnotationOptions.value}="${textAnnotationInput.value}"`;
|
|
||||||
this.app.submitQueryChipElement('text-annotation', `${textAnnotationOptions.value}=${textAnnotationInput.value}`, queryText, null, false, true);
|
|
||||||
this.elements.structuralAttrModal.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
editStartEntityChipElement(queryChipElement) {
|
editStartEntityChipElement(queryChipElement) {
|
||||||
@ -111,15 +79,4 @@ nopaque.corpus_analysis.query_builder.StructuralAttributeBuilderFunctions = clas
|
|||||||
let selection = isEnglishEntType ? this.elements.englishEntTypeSelection : this.elements.germanEntTypeSelection;
|
let selection = isEnglishEntType ? this.elements.englishEntTypeSelection : this.elements.germanEntTypeSelection;
|
||||||
this.app.resetMaterializeSelection([selection], entType);
|
this.app.resetMaterializeSelection([selection], entType);
|
||||||
}
|
}
|
||||||
|
|
||||||
editTextAnnotationChipElement(queryChipElement) {
|
|
||||||
this.elements.structuralAttrModal.open();
|
|
||||||
this.app.toggleClass(['text-annotation-builder'], 'hide', 'remove');
|
|
||||||
this.toggleEditingAreaStructuralAttrModal('add');
|
|
||||||
let [textAnnotationSelection, textAnnotationContent] = queryChipElement.dataset.query
|
|
||||||
.replace(/:: ?match\.text_|"|"/g, '')
|
|
||||||
.split('=');
|
|
||||||
this.app.resetMaterializeSelection([this.elements.textAnnotationSelection], textAnnotationSelection);
|
|
||||||
this.elements.textAnnotationInput.value = textAnnotationContent;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ nopaque.corpus_analysis.query_builder.TokenAttributeBuilderFunctions = class Tok
|
|||||||
this.elements.positionalAttrSelection.appendChild(option);
|
this.elements.positionalAttrSelection.appendChild(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
appendIgnoreCaseCheckbox(parentElement, checked = false) {
|
appendIgnoreCaseCheckbox(parentElement, checked=false) {
|
||||||
let ignoreCaseCheckboxClone = document.querySelector('#ignore-case-checkbox-template').content.cloneNode(true);
|
let ignoreCaseCheckboxClone = document.querySelector('#ignore-case-checkbox-template').content.cloneNode(true);
|
||||||
parentElement.appendChild(ignoreCaseCheckboxClone);
|
parentElement.appendChild(ignoreCaseCheckboxClone);
|
||||||
M.Tooltip.init(parentElement.querySelectorAll('.tooltipped'));
|
M.Tooltip.init(parentElement.querySelectorAll('.tooltipped'));
|
||||||
|
@ -67,7 +67,6 @@
|
|||||||
<div class="col s12">
|
<div class="col s12">
|
||||||
<a class="btn-small waves-effect waves-light" data-structural-attr-modal-action-button="sentence" data-toggle-area="sentence-button">sentence</a>
|
<a class="btn-small waves-effect waves-light" data-structural-attr-modal-action-button="sentence" data-toggle-area="sentence-button">sentence</a>
|
||||||
<a class="btn-small waves-effect waves-light" data-structural-attr-modal-action-button="entity" data-toggle-area="entity-button">entity</a>
|
<a class="btn-small waves-effect waves-light" data-structural-attr-modal-action-button="entity" data-toggle-area="entity-button">entity</a>
|
||||||
<a class="btn-small waves-effect waves-light" data-structural-attr-modal-action-button="meta-data" data-toggle-area="text-annotation-button">Meta Data</a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="corpus-analysis-concordance-entity-builder" data-toggle-area="entity-builder" class="hide">
|
<div id="corpus-analysis-concordance-entity-builder" data-toggle-area="entity-builder" class="hide">
|
||||||
@ -111,39 +110,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="corpus-analysis-concordance-text-annotation-builder" data-toggle-area="text-annotation-builder" class="hide">
|
|
||||||
<p></p>
|
|
||||||
<br>
|
|
||||||
<div class="row">
|
|
||||||
<div class= "input-field col s4 l3">
|
|
||||||
<select name="text-annotation-options" id="corpus-analysis-concordance-text-annotation-options">
|
|
||||||
<option class="btn-small waves-effect waves-light" value="address">address</option>
|
|
||||||
<option class="btn-small waves-effect waves-light" value="author">author</option>
|
|
||||||
<option class="btn-small waves-effect waves-light" value="booktitle">booktitle</option>
|
|
||||||
<option class="btn-small waves-effect waves-light" value="chapter">chapter</option>
|
|
||||||
<option class="btn-small waves-effect waves-light" value="editor">editor</option>
|
|
||||||
<option class="btn-small waves-effect waves-light" value="institution">institution</option>
|
|
||||||
<option class="btn-small waves-effect waves-light" value="journal">journal</option>
|
|
||||||
<option class="btn-small waves-effect waves-light" value="pages">pages</option>
|
|
||||||
<option class="btn-small waves-effect waves-light" value="publisher">publisher</option>
|
|
||||||
<option class="btn-small waves-effect waves-light" value="publishing_year">publishing year</option>
|
|
||||||
<option class="btn-small waves-effect waves-light" value="school">school</option>
|
|
||||||
<option class="btn-small waves-effect waves-light" value="title">title</option>
|
|
||||||
</select>
|
|
||||||
<label>Meta data</label>
|
|
||||||
</div>
|
|
||||||
<div class= "input-field col s7 l5">
|
|
||||||
<i class="material-icons prefix">mode_edit</i>
|
|
||||||
<input placeholder="Type in your text annotation" type="text" id="corpus-analysis-concordance-text-annotation-input">
|
|
||||||
</div>
|
|
||||||
<div class="col s1 l1 center-align">
|
|
||||||
<p class="btn-floating waves-effect waves-light" id="corpus-analysis-concordance-text-annotation-submit">
|
|
||||||
<i class="material-icons right">send</i>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="hide" id="corpus-analysis-concordance-no-value-metadata-message"><i>No value entered!</i></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
Loading…
Reference in New Issue
Block a user