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

View File

@ -8,17 +8,17 @@ class CorpusAnalysisReader {
this.elements = {
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`),
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 = {
perPage: parseInt(this.elements.form['per-page'].value),
textStyle: parseInt(this.elements.form['text-style'].value),
tokenRepresentation: this.elements.form['token-representation'].value,
perPage: parseInt(this.elements.userInterfaceForm['per-page'].value),
textStyle: parseInt(this.elements.userInterfaceForm['text-style'].value),
tokenRepresentation: this.elements.userInterfaceForm['token-representation'].value,
pagination: {
innerWindow: 5,
outerWindow: 1
@ -56,21 +56,21 @@ class CorpusAnalysisReader {
// Init data
this.data.corpus = this.app.data.corpus;
// Add event listeners
this.elements.form.addEventListener('submit', (event) => {
this.elements.userInterfaceForm.addEventListener('submit', (event) => {
event.preventDefault();
this.submitForm();
});
this.elements.form.addEventListener('change', (event) => {
if (event.target === this.elements.form['per-page']) {
this.settings.perPage = parseInt(this.elements.form['per-page'].value);
this.elements.userInterfaceForm.addEventListener('change', (event) => {
if (event.target === this.elements.userInterfaceForm['per-page']) {
this.settings.perPage = parseInt(this.elements.userInterfaceForm['per-page'].value);
this.submitForm();
}
if (event.target === this.elements.form['text-style']) {
this.settings.textStyle = parseInt(this.elements.form['text-style'].value);
if (event.target === this.elements.userInterfaceForm['text-style']) {
this.settings.textStyle = parseInt(this.elements.userInterfaceForm['text-style'].value);
this.setTextStyle();
}
if (event.target === this.elements.form['token-representation']) {
this.settings.tokenRepresentation = this.elements.form['token-representation'].value;
if (event.target === this.elements.userInterfaceForm['token-representation']) {
this.settings.tokenRepresentation = this.elements.userInterfaceForm['token-representation'].value;
this.setTokenRepresentation();
}
});

View File

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

View File

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