This commit is contained in:
Inga Kirschnick 2023-08-11 14:38:18 +02:00
parent 3d38e550a0
commit 8a5c94f448
4 changed files with 78 additions and 59 deletions

View File

@ -32,7 +32,9 @@ class CorpusAnalysisConcordance {
async submitForm() { async submitForm() {
this.app.disableActionElements(); this.app.disableActionElements();
let query = this.elements.form.query.value.trim(); // let query = this.elements.form.query.value.trim();
let query = this.checkQueryInput();
console.log(query);
let subcorpusName = this.elements.form['subcorpus-name'].value; let subcorpusName = this.elements.form['subcorpus-name'].value;
this.elements.error.innerText = ''; this.elements.error.innerText = '';
this.elements.error.classList.add('hide'); this.elements.error.classList.add('hide');
@ -96,6 +98,14 @@ class CorpusAnalysisConcordance {
}); });
} }
checkQueryInput() {
if (document.querySelector('#corpus-analysis-concordance-expert-mode-display').classList.contains('hide')) {
return document.querySelector('#corpus-analysis-concordance-query-preview').innerHTML.trim();
} else {
return this.elements.form.query.value.trim();
}
}
clearSubcorpusList() { clearSubcorpusList() {
this.elements.subcorpusList.innerHTML = ''; this.elements.subcorpusList.innerHTML = '';
this.elements.subcorpusList.classList.add('hide'); this.elements.subcorpusList.classList.add('hide');

View File

@ -17,7 +17,7 @@
<div class="card"> <div class="card">
<div class="card-content"> <div class="card-content">
<div class="row"> <div class="row">
<div class="col s2"> <div class="col s1">
<span class="card-title">Query <i class="material-icons left" style="font-size: inherit;">search</i></span> <span class="card-title">Query <i class="material-icons left" style="font-size: inherit;">search</i></span>
</div> </div>
<div class="col s2"> <div class="col s2">
@ -30,23 +30,12 @@
</div> </div>
</div> </div>
</div> </div>
<form id="corpus-analysis-concordance-form">
<div id="corpus-analysis-concordance-expert-mode-display" class="hide"> <div id="corpus-analysis-concordance-expert-mode-display" class="hide">
{{ expert_mode.card_content() }} {{ expert_mode.card_content() }}
</div> </div>
<div id="corpus-analysis-concordance-query-builder-display"> <div id="corpus-analysis-concordance-query-builder-display">
{{ query_builder.card_content() }} {{ query_builder.card_content() }}
</div> </div>
<div class="row">
<div class="col s12 right-align">
<p class="hide-on-small-only">&nbsp;</p>
<button class="btn waves-effect waves-light corpus-analysis-action" id="corpus-analysis-concordance-form-submit" type="submit" name="submit">
Send
<i class="material-icons right">send</i>
</button>
</div>
</div>
</form>
</div> </div>
</div> </div>

View File

@ -1,5 +1,6 @@
{% macro card_content(id_prefix) %} {% macro card_content(id_prefix) %}
<div class="row"> <div class="row">
<form id="corpus-analysis-concordance-form">
<div class="input-field col s12 m9"> <div class="input-field col s12 m9">
<i class="material-icons prefix">search</i> <i class="material-icons prefix">search</i>
<input class="validate corpus-analysis-action" id="corpus-analysis-concordance-form-query" name="query" type="text" required pattern=".*\S+.*" placeholder="Type in your query or use the Query Builder on the right"></input> <input class="validate corpus-analysis-action" id="corpus-analysis-concordance-form-query" name="query" type="text" required pattern=".*\S+.*" placeholder="Type in your query or use the Query Builder on the right"></input>
@ -13,5 +14,13 @@
<input class="validate corpus-analysis-action" id="corpus-analysis-concordance-form-subcorpus-name" name="subcorpus-name" type="text" required pattern="^[A-Z][a-z0-9\-]*" value="Last"></input> <input class="validate corpus-analysis-action" id="corpus-analysis-concordance-form-subcorpus-name" name="subcorpus-name" type="text" required pattern="^[A-Z][a-z0-9\-]*" value="Last"></input>
<label for="corpus-analysis-concordance-form-subcorpus-name">Subcorpus name</label> <label for="corpus-analysis-concordance-form-subcorpus-name">Subcorpus name</label>
</div> </div>
<div class="col s12 m3 l3 right-align">
<p class="hide-on-small-only">&nbsp;</p>
<button class="btn waves-effect waves-light corpus-analysis-action" id="corpus-analysis-concordance-form-submit" type="submit" name="submit">
Send
<i class="material-icons right">send</i>
</button>
</div>
</form>
</div> </div>
{% endmacro %} {% endmacro %}

View File

@ -1,4 +1,5 @@
{% macro card_content(id_prefix) %} {% macro card_content(id_prefix) %}
<form id="corpus-analysis-concordance-form">
<div class="row"> <div class="row">
<div class="col s9"> <div class="col s9">
<div class="chips" id="corpus-analysis-concordance-form-query-builder"></div> <div class="chips" id="corpus-analysis-concordance-form-query-builder"></div>
@ -31,6 +32,16 @@
<a class="btn waves-effect waves-light tooltipped modal-trigger" href="#corpus-analysis-concordance-structural-attr-modal" data-position="bottom" data-tooltip="Structure your query with structural attributes, for example sentences, entities or annotate the text">Add structural attributes to your query</a> <a class="btn waves-effect waves-light tooltipped modal-trigger" href="#corpus-analysis-concordance-structural-attr-modal" data-position="bottom" data-tooltip="Structure your query with structural attributes, for example sentences, entities or annotate the text">Add structural attributes to your query</a>
</div> </div>
</div> </div>
<div class="row">
<div class="col s12 right-align">
<p class="hide-on-small-only">&nbsp;</p>
<button class="btn waves-effect waves-light corpus-analysis-action" type="submit" name="submit">
Send
<i class="material-icons right">send</i>
</button>
</div>
</div>
</form>
{% endmacro %} {% endmacro %}
{% macro structural_attribute_modal(id_prefix) %} {% macro structural_attribute_modal(id_prefix) %}