Fix id reference errors

This commit is contained in:
Patrick Jentsch 2023-08-08 14:33:07 +02:00
parent f1962b3b47
commit 173aea7df4
3 changed files with 38 additions and 39 deletions

View File

@ -40,8 +40,8 @@ class ConcordanceQueryBuilder {
placeholder: 'Add your query here' placeholder: 'Add your query here'
} }
); );
document.querySelector('#concordance-extension-form-query-builder input').style.setProperty('width', '150px', 'important'); document.querySelector('#corpus-analysis-app-concordance-extension-form-query-builder input').style.setProperty('width', '150px', 'important');
this.elements.positionalAttrModal = M.Modal.init( this.elements.positionalAttrModal = M.Modal.init(
document.querySelector('#positional-attr-modal'), document.querySelector('#positional-attr-modal'),
{ {

View File

@ -2,7 +2,7 @@ class ElementReferencesQueryBuilder {
constructor() { constructor() {
// General Elements // General Elements
this.counter = 0; this.counter = 0;
this.queryInputField = document.querySelector('#concordance-extension-form-query-builder'); this.queryInputField = document.querySelector('#corpus-analysis-app-concordance-extension-form-query-builder');
this.queryInputFieldInstance = M.Chips.getInstance(this.queryInputField); this.queryInputFieldInstance = M.Chips.getInstance(this.queryInputField);
this.queryInputFieldContent = []; this.queryInputFieldContent = [];

View File

@ -2,45 +2,43 @@
{% import 'corpora/_analysis/query_builder/_query_builder.html.j2' as query_builder with context %} {% import 'corpora/_analysis/query_builder/_query_builder.html.j2' as query_builder with context %}
{# The extension icon #}
{% set icon = 'list_alt' %} {% set icon = 'list_alt' %}
{# The extension name #}
{% set name = 'Concordance' %} {% set name = 'Concordance' %}
{# The extension description #}
{% set description = 'Query your corpus with the CQP query language utilizing a KWIC view.' %} {% set description = 'Query your corpus with the CQP query language utilizing a KWIC view.' %}
{% set id_prefix = name.lower().replace(' ', '-') + '-extension' %} {# The extension container content #}
{% macro container_content(id_prefix) %}
{% set tab_content %} <div class="card">
<i class="material-icons left">list_alt</i>{{ name }}</a> <div class="card-content">
{% endset %} <div class="row">
<div class="col s1">
{% set container_content %} <span class="card-title">Query <i class="material-icons left" style="font-size: inherit;">search</i></span>
<div class="row"> </div>
<div class="col s12"> <div class="col s2">
<div class="card"> <div class="switch" style="margin-top:8px; margin-left:0px;">
<div class="card-content"> <label>
<div class="row"> <input type="checkbox" id="{{ id_prefix }}-expert-mode-switch">
<div class="col s1"> <span class="lever"></span>
<span class="card-title">Query <i class="material-icons left" style="font-size: inherit;">search</i></span> expert mode
</div> </label>
<div class="col s2">
<div class="switch" style="margin-top:8px; margin-left:0px;">
<label>
<input type="checkbox" id="{{ id_prefix }}-expert-mode-switch">
<span class="lever"></span>
expert mode
</label>
</div>
</div>
</div>
<div id="{{ id_prefix }}-expert-mode-display" class="hide">
{{ expert_mode.card_content(id_prefix) }}
</div>
<div id="{{ id_prefix }}-query-builder-display">
{{ query_builder.card_content(id_prefix) }}
</div> </div>
</div> </div>
</div> </div>
<div id="{{ id_prefix }}-expert-mode-display" class="hide">
{{ expert_mode.card_content(id_prefix) }}
</div>
<div id="{{ id_prefix }}-query-builder-display">
{{ query_builder.card_content(id_prefix) }}
</div>
</div> </div>
</div>
</div>
<div id="{{ id_prefix }}-subcorpus-list"></div> <div id="{{ id_prefix }}-subcorpus-list"></div>
@ -122,15 +120,16 @@
</div> </div>
{% endmacro %} {% endmacro %}
{% set modals %} {# The extension modals #}
{{ query_builder.structural_attribute_modal() }} {% macro modals(id_prefix) %}
{{ query_builder.positional_attribute_modal() }} {{ query_builder.structural_attribute_modal(id_prefix) }}
{% endset %} {{ query_builder.positional_attribute_modal(id_prefix) }}
{% endmacro %}
{# The extension scripts #} {# The extension scripts #}
{% macro scripts(id_prefix) %} {% macro scripts(id_prefix) %}
<script> <script>
const corpusAnalysisConcordance = new CorpusAnalysisConcordance(corpusAnalysisApp); const corpusAnalysisConcordance = new CorpusAnalysisConcordance(corpusAnalysisApp, "{{ id_prefix }}");
let queryBuilderDisplay = document.getElementById("{{ id_prefix }}-query-builder-display"); let queryBuilderDisplay = document.getElementById("{{ id_prefix }}-query-builder-display");
let expertModeDisplay = document.getElementById("{{ id_prefix }}-expert-mode-display"); let expertModeDisplay = document.getElementById("{{ id_prefix }}-expert-mode-display");
@ -148,4 +147,4 @@
const concordanceQueryBuilder = new ConcordanceQueryBuilder(); const concordanceQueryBuilder = new ConcordanceQueryBuilder();
</script> </script>
{# {{ query_builder.scripts() }} #} {# {{ query_builder.scripts() }} #}
{% endset %} {% endmacro %}