Small fixes

This commit is contained in:
Inga Kirschnick 2022-10-24 15:01:13 +02:00
parent cbf3abb424
commit 0b3456f877
4 changed files with 28 additions and 35 deletions

View File

@ -166,7 +166,6 @@ class ConcordanceQueryBuilder {
}
// ##########################################################################
// #################### General Functions ###################################
// ##########################################################################
@ -229,23 +228,9 @@ class ConcordanceQueryBuilder {
this.elements.queryContainer.classList.remove('hide');
this.queryPreviewBuilder();
// Opens a hint about the possible functions for editing the query when the first chip is added. It is displayed for 5 seconds and then deleted.
if (this.elements.yourQuery.classList.contains('tooltipped')) {
let tooltipInstance = M.Tooltip.getInstance(this.elements.yourQuery);
tooltipInstance.tooltipEl.style.background = '#98ACD2';
tooltipInstance.tooltipEl.style.borderTop = 'solid 4px #0064A3'
tooltipInstance.tooltipEl.style.padding = '10px';
tooltipInstance.tooltipEl.style.color = 'black';
if (tooltipInstance !== undefined) {
setTimeout(() => {
tooltipInstance.open();
setTimeout(() => {
tooltipInstance.destroy();
}, 5000);
}, 500);
}
this.elements.yourQuery.classList.remove('tooltipped');
// Shows a hint about possible functions for editing the query at the first added element in the query
if (this.elements.yourQuery.childNodes.length === 1) {
app.flash('You can edit your query by deleting individual elements or moving them via drag and drop.');
}
}
@ -329,12 +314,15 @@ class ConcordanceQueryBuilder {
deleteAttr(attr) {
this.elements.yourQuery.removeChild(attr);
if (attr.dataset.type === "start-sentence") {
this.elements.sentence.innerHTML = 'Sentence';
} else if (attr.dataset.type === "start-entity" || attr.dataset.type === "start-empty-entity") {
this.elements.entity.innerHTML = 'Entity';
}
this.elements.counter -= 1;
if (this.elements.counter === 0) {
this.elements.queryContainer.classList.add('hide');
}
this.queryPreviewBuilder();
}
@ -374,12 +362,19 @@ class ConcordanceQueryBuilder {
entityEndCounter += 1;
}
}
if (sentenceCounter !== sentenceEndCounter) {
app.flash('Please add a closing sentence tag', 'error');
// Checks if the same number of opening and closing tags (entity and sentence) are present. Depending on what is missing, the corresponding error message is ejected
if (sentenceCounter > sentenceEndCounter) {
app.flash('Please add the closing sentence tag', 'error');
this.elements.valueValidator = false;
} else if (sentenceCounter < sentenceEndCounter) {
app.flash('Please remove the closing sentence tag', 'error');
this.elements.valueValidator = false;
}
if (entityCounter !== entityEndCounter) {
app.flash('Please add a closing entity tag', 'error');
if (entityCounter > entityEndCounter) {
app.flash('Please add the closing entity tag', 'error');
this.elements.valueValidator = false;
} else if (entityCounter < entityEndCounter) {
app.flash('Please remove the closing entity tag', 'error');
this.elements.valueValidator = false;
}
}
@ -395,6 +390,8 @@ class ConcordanceQueryBuilder {
this.elements.structuralAttrArea.classList.add('hide');
this.elements.yourQuery.innerHTML = '';
this.elements.queryContainer.classList.add('hide');
this.elements.entity.innerHTML = 'Entity';
this.elements.sentence.innerHTML = 'Sentence';
instance.tooltipEl.style.background = '#98ACD2';
instance.tooltipEl.style.borderTop = 'solid 4px #0064A3';
@ -420,8 +417,6 @@ class ConcordanceQueryBuilder {
//#endregion General Functions
// ##########################################################################
// ############## Token Attribute Builder Functions #########################
// ##########################################################################
@ -871,8 +866,6 @@ class ConcordanceQueryBuilder {
//#endregion Token Attribute Builder Functions
// ##########################################################################
// ############ Structural Attribute Builder Functions ######################
// ##########################################################################
@ -961,7 +954,7 @@ class ConcordanceQueryBuilder {
this.elements.noValueMetadataMessage.classList.add('hide');
}, 3000);
} else {
let queryText = `:: match.text_${this.elements.textAnnotationOptions.value}='${this.elements.textAnnotationInput.value}'`;
let queryText = `:: match.text_${this.elements.textAnnotationOptions.value}="${this.elements.textAnnotationInput.value}"`;
this.buttonfactory('text-annotation', `${this.elements.textAnnotationOptions.value}=${this.elements.textAnnotationInput.value}`, queryText);
this.hideEverything();
}

View File

@ -66,7 +66,7 @@
<p class="hide-on-small-only">&nbsp;</p>
<a class="btn waves-effect waves-light modal-trigger" href="#concordance-query-builder" id="concordance-query-builder-button">
<i class="material-icons left">build</i>
Query builder
Query builder (beta)
</a>
<button class="btn waves-effect waves-light corpus-analysis-action" id="concordance-extension-form-submit" type="submit" name="submit">
Send

View File

@ -254,7 +254,7 @@
<div>
<nav>
<div class="nav-wrapper" id="query-builder-nav">
<a href="#!" class="brand-logo"><i class="material-icons">build</i>Query Builder</a>
<a href="#!" class="brand-logo"><i class="material-icons">build</i>Query Builder (beta)</a>
<i class="material-icons close right" id="close-query-builder">close</i>
<a class="modal-trigger" href="#query-builder-tutorial-modal" >
<i class="material-icons right tooltipped" id="query-builder-tutorial-info-icon" data-position="bottom" data-tooltip="Click here if you are unsure how to use the Query Builder <br>and want to find out what other options it offers.">help</i>
@ -274,7 +274,7 @@
</h6>
</div>
<div class="row">
<div class="col s10 tooltipped" id="your-query" data-position="bottom" data-tooltip="You can edit your query by deleting individual elements or moving them via drag and drop."></div>
<div class="col s10" id="your-query"></div>
<a class="btn-small waves-effect waves-teal col s1" id="insert-query-button">
<i class="material-icons">send</i>
</a>

View File

@ -106,7 +106,7 @@
</h6>
</div>
<div class="row">
<div class="col s10 tooltipped" id="your-query" data-position="bottom" data-tooltip="You can edit your query by deleting individual elements or moving them via drag and drop."></div>
<div class="col s10" id="your-query" data-position="bottom" data-tooltip="You can edit your query by deleting individual elements or moving them via drag and drop."></div>
<a class="btn-small waves-effect waves-teal col s1" id="insert-query-button">
<i class="material-icons">send</i>
</a>