From 4f24e9f9da7af3166a04a3bc56600cd0f1c625e9 Mon Sep 17 00:00:00 2001 From: Inga Kirschnick Date: Tue, 14 Nov 2023 09:48:38 +0100 Subject: [PATCH] Erase meta data logic from struc attribute builder --- .../query-builder/element-references.js | 4 +- .../structural-attribute-builder-functions.js | 47 +------------------ .../token-attribute-builder-functions.js | 2 +- .../query_builder/_query_builder.html.j2 | 34 -------------- 4 files changed, 4 insertions(+), 83 deletions(-) diff --git a/app/static/js/corpus-analysis/query-builder/element-references.js b/app/static/js/corpus-analysis/query-builder/element-references.js index 39297967..29465112 100644 --- a/app/static/js/corpus-analysis/query-builder/element-references.js +++ b/app/static/js/corpus-analysis/query-builder/element-references.js @@ -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.englishEntTypeSelection = document.querySelector('#corpus-analysis-concordance-english-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 this.positionalAttrModal = M.Modal.getInstance(document.querySelector('#corpus-analysis-concordance-positional-attr-modal')); this.positionalAttrSelection = document.querySelector('#corpus-analysis-concordance-positional-attr-selection'); diff --git a/app/static/js/corpus-analysis/query-builder/structural-attribute-builder-functions.js b/app/static/js/corpus-analysis/query-builder/structural-attribute-builder-functions.js index a5667d2a..e9aadcac 100644 --- a/app/static/js/corpus-analysis/query-builder/structural-attribute-builder-functions.js +++ b/app/static/js/corpus-analysis/query-builder/structural-attribute-builder-functions.js @@ -5,8 +5,6 @@ nopaque.corpus_analysis.query_builder.StructuralAttributeBuilderFunctions = clas this.structuralAttrModalEventlisteners(); - document.querySelector('#corpus-analysis-concordance-text-annotation-submit').addEventListener('click', () => this.textAnnotationSubmitHandler()); - this.elements.structuralAttrModal = M.Modal.init( document.querySelector('#corpus-analysis-concordance-structural-attr-modal'), { @@ -46,10 +44,7 @@ nopaque.corpus_analysis.query_builder.StructuralAttributeBuilderFunctions = clas resetStructuralAttrModal() { this.app.resetMaterializeSelection([this.elements.englishEntTypeSelection, this.elements.germanEntTypeSelection]); - this.app.resetMaterializeSelection([this.elements.textAnnotationSelection], 'address'); - this.elements.textAnnotationInput.value = ''; - - this.app.toggleClass(['entity-builder', 'text-annotation-builder'], 'hide', 'add'); + this.app.toggleClass(['entity-builder'], 'hide', 'add'); this.toggleEditingAreaStructuralAttrModal('remove'); this.elements.editingModusOn = false; this.elements.editedQueryChipElementIndex = undefined; @@ -64,11 +59,6 @@ nopaque.corpus_analysis.query_builder.StructuralAttributeBuilderFunctions = clas break; case 'entity': 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; default: break; @@ -77,29 +67,7 @@ nopaque.corpus_analysis.query_builder.StructuralAttributeBuilderFunctions = clas toggleEditingAreaStructuralAttrModal(action) { // 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); - } - - 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(); - } + this.app.toggleClass(['sentence-button', 'entity-button', 'any-type-entity-button'], 'disabled', action); } editStartEntityChipElement(queryChipElement) { @@ -111,15 +79,4 @@ nopaque.corpus_analysis.query_builder.StructuralAttributeBuilderFunctions = clas let selection = isEnglishEntType ? this.elements.englishEntTypeSelection : this.elements.germanEntTypeSelection; 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; - } } diff --git a/app/static/js/corpus-analysis/query-builder/token-attribute-builder-functions.js b/app/static/js/corpus-analysis/query-builder/token-attribute-builder-functions.js index 9633583b..14ea5f5f 100644 --- a/app/static/js/corpus-analysis/query-builder/token-attribute-builder-functions.js +++ b/app/static/js/corpus-analysis/query-builder/token-attribute-builder-functions.js @@ -136,7 +136,7 @@ nopaque.corpus_analysis.query_builder.TokenAttributeBuilderFunctions = class Tok this.elements.positionalAttrSelection.appendChild(option); } - appendIgnoreCaseCheckbox(parentElement, checked = false) { + appendIgnoreCaseCheckbox(parentElement, checked=false) { let ignoreCaseCheckboxClone = document.querySelector('#ignore-case-checkbox-template').content.cloneNode(true); parentElement.appendChild(ignoreCaseCheckboxClone); M.Tooltip.init(parentElement.querySelectorAll('.tooltipped')); diff --git a/app/templates/corpora/_analysis/query_builder/_query_builder.html.j2 b/app/templates/corpora/_analysis/query_builder/_query_builder.html.j2 index 3a3bf2fe..4953e41c 100644 --- a/app/templates/corpora/_analysis/query_builder/_query_builder.html.j2 +++ b/app/templates/corpora/_analysis/query_builder/_query_builder.html.j2 @@ -67,7 +67,6 @@
sentence entity - Meta Data
@@ -111,39 +110,6 @@
-
-

-
-
-
- - -
-
- mode_edit - -
-
-

- send -

-
-
No value entered!
-
-
{% endmacro %}