mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-25 02:44:18 +00:00
Further javascript improvements
This commit is contained in:
parent
7cae84ffdc
commit
d3f2d5648e
@ -1,8 +1,8 @@
|
|||||||
class CreateContributionForm extends Form {
|
Forms.CreateContributionForm = class CreateContributionForm extends Forms.BaseForm {
|
||||||
static autoInit() {
|
static autoInit() {
|
||||||
let createContributionFormElements = document.querySelectorAll('.create-contribution-form');
|
let createContributionFormElements = document.querySelectorAll('.create-contribution-form');
|
||||||
for (let createContributionFormElement of createContributionFormElements) {
|
for (let createContributionFormElement of createContributionFormElements) {
|
||||||
new CreateContributionForm(createContributionFormElement);
|
new Forms.CreateContributionForm(createContributionFormElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -15,4 +15,4 @@ class CreateContributionForm extends Form {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
@ -1,8 +1,8 @@
|
|||||||
class CreateCorpusFileForm extends Form {
|
Forms.CreateCorpusFileForm = class CreateCorpusFileForm extends Forms.BaseForm {
|
||||||
static autoInit() {
|
static autoInit() {
|
||||||
let createCorpusFileFormElements = document.querySelectorAll('.create-corpus-file-form');
|
let createCorpusFileFormElements = document.querySelectorAll('.create-corpus-file-form');
|
||||||
for (let createCorpusFileFormElement of createCorpusFileFormElements) {
|
for (let createCorpusFileFormElement of createCorpusFileFormElements) {
|
||||||
new CreateCorpusFileForm(createCorpusFileFormElement);
|
new Forms.CreateCorpusFileForm(createCorpusFileFormElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -15,4 +15,4 @@ class CreateCorpusFileForm extends Form {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
@ -1,8 +1,8 @@
|
|||||||
class CreateJobForm extends Form {
|
Forms.CreateJobForm = class CreateJobForm extends Forms.BaseForm {
|
||||||
static autoInit() {
|
static autoInit() {
|
||||||
let createJobFormElements = document.querySelectorAll('.create-job-form');
|
let createJobFormElements = document.querySelectorAll('.create-job-form');
|
||||||
for (let createJobFormElement of createJobFormElements) {
|
for (let createJobFormElement of createJobFormElements) {
|
||||||
new CreateJobForm(createJobFormElement);
|
new Forms.CreateJobForm(createJobFormElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,4 +22,4 @@ class CreateJobForm extends Form {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
@ -1,9 +1,17 @@
|
|||||||
class Form {
|
var Forms = {};
|
||||||
static autoInit() {
|
|
||||||
CreateContributionForm.autoInit();
|
Forms.autoInit = () => {
|
||||||
CreateCorpusFileForm.autoInit();
|
for (let propertyName in Forms) {
|
||||||
CreateJobForm.autoInit();
|
let property = Forms[propertyName];
|
||||||
|
// Call the autoInit method of all properties that are subclasses of Forms.BaseForm
|
||||||
|
if (property.prototype instanceof Forms.BaseForm) {
|
||||||
|
property.autoInit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Forms.BaseForm = class BaseForm {
|
||||||
|
static autoInit() {throw 'Not implemented';}
|
||||||
|
|
||||||
constructor(formElement) {
|
constructor(formElement) {
|
||||||
this.formElement = formElement;
|
this.formElement = formElement;
|
||||||
@ -139,4 +147,4 @@ class Form {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
@ -102,4 +102,4 @@ ResourceDisplays.CorpusDisplay = class CorpusDisplay extends ResourceDisplays.Ba
|
|||||||
new Date(creationDate).toLocaleString("en-US")
|
new Date(creationDate).toLocaleString("en-US")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
@ -123,4 +123,4 @@ ResourceDisplays.JobDisplay = class JobDisplay extends ResourceDisplays.BaseDisp
|
|||||||
setServiceVersion(serviceVersion) {
|
setServiceVersion(serviceVersion) {
|
||||||
this.setElements(this.displayElement.querySelectorAll('.job-service-version'), serviceVersion);
|
this.setElements(this.displayElement.querySelectorAll('.job-service-version'), serviceVersion);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
@ -35,10 +35,10 @@
|
|||||||
{%- assets
|
{%- assets
|
||||||
filters='rjsmin',
|
filters='rjsmin',
|
||||||
output='gen/Forms.%(version)s.js',
|
output='gen/Forms.%(version)s.js',
|
||||||
'js/Forms/Form.js',
|
'js/forms/index.js',
|
||||||
'js/Forms/CreateCorpusFileForm.js',
|
'js/forms/create-contribution-form.js',
|
||||||
'js/Forms/CreateJobForm.js',
|
'js/forms/create-corpus-file-form.js',
|
||||||
'js/Forms/CreateContributionForm.js'
|
'js/forms/create-job-form.js'
|
||||||
%}
|
%}
|
||||||
<script src="{{ ASSET_URL }}"></script>
|
<script src="{{ ASSET_URL }}"></script>
|
||||||
{%- endassets %}
|
{%- endassets %}
|
||||||
@ -141,7 +141,7 @@
|
|||||||
{alignment: 'right', constrainWidth: false, coverTrigger: false}
|
{alignment: 'right', constrainWidth: false, coverTrigger: false}
|
||||||
);
|
);
|
||||||
ResourceList.autoInit();
|
ResourceList.autoInit();
|
||||||
Form.autoInit();
|
Forms.autoInit();
|
||||||
|
|
||||||
// Display flashed messages
|
// Display flashed messages
|
||||||
for (let [category, message] of {{ get_flashed_messages(with_categories=True)|tojson }}) {
|
for (let [category, message] of {{ get_flashed_messages(with_categories=True)|tojson }}) {
|
||||||
|
Loading…
Reference in New Issue
Block a user