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() {
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;
this.elements.error.innerText = '';
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() {
this.elements.subcorpusList.innerHTML = '';
this.elements.subcorpusList.classList.add('hide');

View File

@ -17,7 +17,7 @@
<div class="card">
<div class="card-content">
<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>
</div>
<div class="col s2">
@ -30,23 +30,12 @@
</div>
</div>
</div>
<form id="corpus-analysis-concordance-form">
<div id="corpus-analysis-concordance-expert-mode-display" class="hide">
{{ expert_mode.card_content() }}
</div>
<div id="corpus-analysis-concordance-query-builder-display">
{{ query_builder.card_content() }}
</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>

View File

@ -1,5 +1,6 @@
{% macro card_content(id_prefix) %}
<div class="row">
<form id="corpus-analysis-concordance-form">
<div class="input-field col s12 m9">
<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>
@ -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>
<label for="corpus-analysis-concordance-form-subcorpus-name">Subcorpus name</label>
</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>
{% endmacro %}

View File

@ -1,5 +1,6 @@
{% macro card_content(id_prefix) %}
<div class="row">
<form id="corpus-analysis-concordance-form">
<div class="row">
<div class="col s9">
<div class="chips" id="corpus-analysis-concordance-form-query-builder"></div>
</div>
@ -8,29 +9,39 @@
<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>
</div>
</div>
<div class="row">
</div>
<div class="row">
<div class="col s12">
<span class="error-color-text helper-text hide" id="corpus-analysis-concordance-error"></span>
<a class="modal-trigger" data-manual-modal-chapter="manual-modal-cqp-query-language" href="#manual-modal"><i class="material-icons" style="font-size: inherit;">help</i> Corpus Query Language tutorial</a>
<span> | </span>
<a class="modal-trigger" data-manual-modal-chapter="manual-modal-tagsets" href="#manual-modal"><i class="material-icons" style="font-size: inherit;">info</i> Tagsets</a>
</div>
</div>
<div class="row">
</div>
<div class="row">
<div class="col s12 hide">
<p><i> Preview:</i></p>
<p id="corpus-analysis-concordance-query-preview"></p>
<br>
</div>
</div>
<div class="row">
</div>
<div class="row">
<div class="col s12">
<p></p>
<a class="btn waves-effect waves-light tooltipped modal-trigger" href="#corpus-analysis-concordance-positional-attr-modal" data-position="bottom" data-tooltip="Search for any token, for example a word, a lemma or a part-of-speech tag">Add new token 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 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 %}
{% macro structural_attribute_modal(id_prefix) %}