rename ui-form

This commit is contained in:
Patrick Jentsch 2023-08-08 14:07:07 +02:00
parent 766c5ba27d
commit 0d92f221cb
4 changed files with 32 additions and 32 deletions

View File

@ -9,7 +9,7 @@ class CorpusAnalysisConcordance {
this.elements = { this.elements = {
container: document.querySelector(`#${idPrefix}-container`), container: document.querySelector(`#${idPrefix}-container`),
error: document.querySelector(`#${idPrefix}-error`), error: document.querySelector(`#${idPrefix}-error`),
UIForm: document.querySelector(`#${idPrefix}-ui-form`), userInterfaceForm: document.querySelector(`#${idPrefix}-user-interface-form`),
form: document.querySelector(`#${idPrefix}-form`), form: document.querySelector(`#${idPrefix}-form`),
progress: document.querySelector(`#${idPrefix}-progress`), progress: document.querySelector(`#${idPrefix}-progress`),
subcorpusInfo: document.querySelector(`#${idPrefix}-subcorpus-info`), subcorpusInfo: document.querySelector(`#${idPrefix}-subcorpus-info`),
@ -20,11 +20,11 @@ class CorpusAnalysisConcordance {
}; };
this.settings = { this.settings = {
context: parseInt(this.elements.UIForm['context'].value), context: parseInt(this.elements.userInterfaceForm['context'].value),
perPage: parseInt(this.elements.UIForm['per-page'].value), perPage: parseInt(this.elements.userInterfaceForm['per-page'].value),
selectedSubcorpus: undefined, selectedSubcorpus: undefined,
textStyle: parseInt(this.elements.UIForm['text-style'].value), textStyle: parseInt(this.elements.userInterfaceForm['text-style'].value),
tokenRepresentation: this.elements.UIForm['token-representation'].value tokenRepresentation: this.elements.userInterfaceForm['token-representation'].value
}; };
console.log(this.settings); console.log(this.settings);
@ -77,24 +77,24 @@ class CorpusAnalysisConcordance {
event.preventDefault(); event.preventDefault();
this.submitForm(); this.submitForm();
}); });
this.elements.UIForm.addEventListener('change', (event) => { this.elements.userInterfaceForm.addEventListener('change', (event) => {
if (event.target === this.elements.UIForm['context']) { if (event.target === this.elements.userInterfaceForm['context']) {
console.log(this.settings.context); console.log(this.settings.context);
console.log(parseInt(this.elements.UIForm['context'].value)); console.log(parseInt(this.elements.userInterfaceForm['context'].value));
this.settings.context = parseInt(this.elements.UIForm['context'].value); this.settings.context = parseInt(this.elements.userInterfaceForm['context'].value);
console.log(this.settings.context); console.log(this.settings.context);
this.submitForm(); this.submitForm();
} }
if (event.target === this.elements.UIForm['per-page']) { if (event.target === this.elements.userInterfaceForm['per-page']) {
this.settings.perPage = parseInt(this.elements.UIForm['per-page'].value); this.settings.perPage = parseInt(this.elements.userInterfaceForm['per-page'].value);
this.submitForm(); this.submitForm();
} }
if (event.target === this.elements.UIForm['text-style']) { if (event.target === this.elements.userInterfaceForm['text-style']) {
this.settings.textStyle = parseInt(this.elements.UIForm['text-style'].value); this.settings.textStyle = parseInt(this.elements.userInterfaceForm['text-style'].value);
this.setTextStyle(); this.setTextStyle();
} }
if (event.target === this.elements.UIForm['token-representation']) { if (event.target === this.elements.userInterfaceForm['token-representation']) {
this.settings.tokenRepresentation = this.elements.UIForm['token-representation'].value; this.settings.tokenRepresentation = this.elements.userInterfaceForm['token-representation'].value;
this.setTokenRepresentation(); this.setTokenRepresentation();
} }
}); });

View File

@ -8,17 +8,17 @@ class CorpusAnalysisReader {
this.elements = { this.elements = {
container: document.querySelector(`#${idPrefix}-container`), container: document.querySelector(`#${idPrefix}-container`),
error: document.querySelector(`#${idPrefix}-error`),
form: document.querySelector(`#${idPrefix}-form`),
progress: document.querySelector(`#${idPrefix}-progress`),
corpus: document.querySelector(`#${idPrefix}-corpus`), corpus: document.querySelector(`#${idPrefix}-corpus`),
corpusPagination: document.querySelector(`#${idPrefix}-corpus-pagination`) corpusPagination: document.querySelector(`#${idPrefix}-corpus-pagination`),
error: document.querySelector(`#${idPrefix}-error`),
progress: document.querySelector(`#${idPrefix}-progress`),
userInterfaceForm: document.querySelector(`#${idPrefix}-user-interface-form`)
}; };
this.settings = { this.settings = {
perPage: parseInt(this.elements.form['per-page'].value), perPage: parseInt(this.elements.userInterfaceForm['per-page'].value),
textStyle: parseInt(this.elements.form['text-style'].value), textStyle: parseInt(this.elements.userInterfaceForm['text-style'].value),
tokenRepresentation: this.elements.form['token-representation'].value, tokenRepresentation: this.elements.userInterfaceForm['token-representation'].value,
pagination: { pagination: {
innerWindow: 5, innerWindow: 5,
outerWindow: 1 outerWindow: 1
@ -56,21 +56,21 @@ class CorpusAnalysisReader {
// Init data // Init data
this.data.corpus = this.app.data.corpus; this.data.corpus = this.app.data.corpus;
// Add event listeners // Add event listeners
this.elements.form.addEventListener('submit', (event) => { this.elements.userInterfaceForm.addEventListener('submit', (event) => {
event.preventDefault(); event.preventDefault();
this.submitForm(); this.submitForm();
}); });
this.elements.form.addEventListener('change', (event) => { this.elements.userInterfaceForm.addEventListener('change', (event) => {
if (event.target === this.elements.form['per-page']) { if (event.target === this.elements.userInterfaceForm['per-page']) {
this.settings.perPage = parseInt(this.elements.form['per-page'].value); this.settings.perPage = parseInt(this.elements.userInterfaceForm['per-page'].value);
this.submitForm(); this.submitForm();
} }
if (event.target === this.elements.form['text-style']) { if (event.target === this.elements.userInterfaceForm['text-style']) {
this.settings.textStyle = parseInt(this.elements.form['text-style'].value); this.settings.textStyle = parseInt(this.elements.userInterfaceForm['text-style'].value);
this.setTextStyle(); this.setTextStyle();
} }
if (event.target === this.elements.form['token-representation']) { if (event.target === this.elements.userInterfaceForm['token-representation']) {
this.settings.tokenRepresentation = this.elements.form['token-representation'].value; this.settings.tokenRepresentation = this.elements.userInterfaceForm['token-representation'].value;
this.setTokenRepresentation(); this.setTokenRepresentation();
} }
}); });

View File

@ -80,7 +80,7 @@
<div class="progress hide" id="{{ id_prefix }}-progress"> <div class="progress hide" id="{{ id_prefix }}-progress">
<div class="indeterminate"></div> <div class="indeterminate"></div>
</div> </div>
<form id="{{ id_prefix }}-ui-form"> <form id="{{ id_prefix }}-user-interface-form">
<div class="row"> <div class="row">
<div class="col s12 m9 l9"> <div class="col s12 m9 l9">
<div class="row"> <div class="row">

View File

@ -12,7 +12,7 @@
{% macro container_content(id_prefix) %} {% macro container_content(id_prefix) %}
<div class="card"> <div class="card">
<div class="card-content"> <div class="card-content">
<form id="{{ id_prefix }}-form"> <form id="{{ id_prefix }}-user-interface-form">
<div class="row"> <div class="row">
<div class="col s12 m9 l10"> <div class="col s12 m9 l10">
<div class="row"> <div class="row">