mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-03-13 22:20:34 +00:00
Compare commits
3 Commits
53f4400731
...
d3f2d5648e
Author | SHA1 | Date | |
---|---|---|---|
|
d3f2d5648e | ||
|
7cae84ffdc | ||
|
1d6834302d |
@ -29,7 +29,7 @@ class JobList extends ResourceList {
|
||||
|
||||
get item() {
|
||||
return `
|
||||
<tr class="list-item service-scheme">
|
||||
<tr class="list-item service-scheme clickable hoverable">
|
||||
<td>
|
||||
<label class="list-action-trigger" data-list-action="select">
|
||||
<input class="select-checkbox" type="checkbox">
|
||||
@ -112,7 +112,7 @@ class JobList extends ResourceList {
|
||||
if (listItemElement === null) {return;}
|
||||
let itemId = listItemElement.dataset.id;
|
||||
let listActionElement = event.target.closest('.list-action-trigger[data-list-action]');
|
||||
let listAction = listActionElement === null ? '' : listActionElement.dataset.listAction;
|
||||
let listAction = listActionElement === null ? 'view' : listActionElement.dataset.listAction;
|
||||
switch (listAction) {
|
||||
case 'delete-request': {
|
||||
let values = this.listjs.get('id', itemId)[0].values();
|
||||
|
@ -1,8 +1,8 @@
|
||||
class CreateContributionForm extends Form {
|
||||
Forms.CreateContributionForm = class CreateContributionForm extends Forms.BaseForm {
|
||||
static autoInit() {
|
||||
let createContributionFormElements = document.querySelectorAll('.create-contribution-form');
|
||||
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() {
|
||||
let createCorpusFileFormElements = document.querySelectorAll('.create-corpus-file-form');
|
||||
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() {
|
||||
let createJobFormElements = document.querySelectorAll('.create-job-form');
|
||||
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 {
|
||||
static autoInit() {
|
||||
CreateContributionForm.autoInit();
|
||||
CreateCorpusFileForm.autoInit();
|
||||
CreateJobForm.autoInit();
|
||||
var Forms = {};
|
||||
|
||||
Forms.autoInit = () => {
|
||||
for (let propertyName in Forms) {
|
||||
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) {
|
||||
this.formElement = formElement;
|
||||
@ -139,4 +147,4 @@ class Form {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
@ -1,4 +1,4 @@
|
||||
class CorpusDisplay extends ResourceDisplay {
|
||||
ResourceDisplays.CorpusDisplay = class CorpusDisplay extends ResourceDisplays.BaseDisplay {
|
||||
constructor(displayElement) {
|
||||
super(displayElement);
|
||||
this.corpusId = displayElement.dataset.corpusId;
|
||||
@ -102,4 +102,4 @@ class CorpusDisplay extends ResourceDisplay {
|
||||
new Date(creationDate).toLocaleString("en-US")
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
@ -1,4 +1,6 @@
|
||||
class ResourceDisplay {
|
||||
var ResourceDisplays = {};
|
||||
|
||||
ResourceDisplays.BaseDisplay = class BaseDisplay {
|
||||
constructor(displayElement) {
|
||||
this.displayElement = displayElement;
|
||||
this.userId = this.displayElement.dataset.userId;
|
||||
@ -41,4 +43,4 @@ class ResourceDisplay {
|
||||
this.setElement(element, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
@ -1,4 +1,4 @@
|
||||
class JobDisplay extends ResourceDisplay {
|
||||
ResourceDisplays.JobDisplay = class JobDisplay extends ResourceDisplays.BaseDisplay {
|
||||
constructor(displayElement) {
|
||||
super(displayElement);
|
||||
this.jobId = this.displayElement.dataset.jobId;
|
||||
@ -123,4 +123,4 @@ class JobDisplay extends ResourceDisplay {
|
||||
setServiceVersion(serviceVersion) {
|
||||
this.setElements(this.displayElement.querySelectorAll('.job-service-version'), serviceVersion);
|
||||
}
|
||||
}
|
||||
};
|
@ -35,20 +35,20 @@
|
||||
{%- assets
|
||||
filters='rjsmin',
|
||||
output='gen/Forms.%(version)s.js',
|
||||
'js/Forms/Form.js',
|
||||
'js/Forms/CreateCorpusFileForm.js',
|
||||
'js/Forms/CreateJobForm.js',
|
||||
'js/Forms/CreateContributionForm.js'
|
||||
'js/forms/index.js',
|
||||
'js/forms/create-contribution-form.js',
|
||||
'js/forms/create-corpus-file-form.js',
|
||||
'js/forms/create-job-form.js'
|
||||
%}
|
||||
<script src="{{ ASSET_URL }}"></script>
|
||||
{%- endassets %}
|
||||
|
||||
{%- assets
|
||||
filters='rjsmin',
|
||||
output='gen/ResourceDisplays.%(version)s.js',
|
||||
'js/ResourceDisplays/ResourceDisplay.js',
|
||||
'js/ResourceDisplays/CorpusDisplay.js',
|
||||
'js/ResourceDisplays/JobDisplay.js'
|
||||
output='gen/resource-displays.%(version)s.js',
|
||||
'js/resource-displays/index.js',
|
||||
'js/resource-displays/corpus-display.js',
|
||||
'js/resource-displays/job-display.js'
|
||||
%}
|
||||
<script src="{{ ASSET_URL }}"></script>
|
||||
{%- endassets %}
|
||||
@ -141,7 +141,7 @@
|
||||
{alignment: 'right', constrainWidth: false, coverTrigger: false}
|
||||
);
|
||||
ResourceList.autoInit();
|
||||
Form.autoInit();
|
||||
Forms.autoInit();
|
||||
|
||||
// Display flashed messages
|
||||
for (let [category, message] of {{ get_flashed_messages(with_categories=True)|tojson }}) {
|
||||
|
@ -237,7 +237,7 @@
|
||||
{% block scripts %}
|
||||
{{ super() }}
|
||||
<script>
|
||||
let corpusDisplay = new CorpusDisplay(document.querySelector('#corpus-display'));
|
||||
let corpusDisplay = new ResourceDisplays.CorpusDisplay(document.querySelector('#corpus-display'));
|
||||
|
||||
{# {% if current_user.is_following_corpus(corpus) %}
|
||||
let unfollowRequestElement = document.querySelector('.action-button[data-action="unfollow-request"]');
|
||||
|
@ -150,7 +150,7 @@
|
||||
{% block scripts %}
|
||||
{{ super() }}
|
||||
<script>
|
||||
let jobDisplay = new JobDisplay(document.querySelector('#job-display'));
|
||||
let jobDisplay = new ResourceDisplays.JobDisplay(document.querySelector('#job-display'));
|
||||
let deleteJobRequestElement = document.querySelector('#delete-job-request');
|
||||
let restartJobRequestElement = document.querySelector('#restart-job-request');
|
||||
deleteJobRequestElement.addEventListener('click', (event) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user