From 16dc87bc94ff6bfab6b1af0642c6004ae8d56a56 Mon Sep 17 00:00:00 2001
From: Patrick Jentsch
Date: Wed, 13 Jan 2021 11:55:58 +0100
Subject: [PATCH] Register RessourceList click event listener in base Class.
---
web/app/static/js/nopaque/lists/CorpusFileList.js | 1 -
web/app/static/js/nopaque/lists/CorpusList.js | 1 -
web/app/static/js/nopaque/lists/JobInputList.js | 1 -
web/app/static/js/nopaque/lists/JobList.js | 1 -
web/app/static/js/nopaque/lists/JobResultList.js | 1 -
web/app/static/js/nopaque/lists/QueryResultList.js | 1 -
web/app/static/js/nopaque/lists/RessourceList.js | 1 +
7 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/web/app/static/js/nopaque/lists/CorpusFileList.js b/web/app/static/js/nopaque/lists/CorpusFileList.js
index 478be52e..c4926637 100644
--- a/web/app/static/js/nopaque/lists/CorpusFileList.js
+++ b/web/app/static/js/nopaque/lists/CorpusFileList.js
@@ -3,7 +3,6 @@ class CorpusFileList extends RessourceList {
super(listElement, {...CorpusFileList.options, ...options});
this.corpus = undefined;
this.user.eventListeners.corpus.addEventListener((eventType, payload) => this.eventHandler(eventType, payload), listElement.dataset.corpusId);
- listElement.addEventListener('click', event => this.onclick(event));
}
init(corpus) {
diff --git a/web/app/static/js/nopaque/lists/CorpusList.js b/web/app/static/js/nopaque/lists/CorpusList.js
index a3433411..13197534 100644
--- a/web/app/static/js/nopaque/lists/CorpusList.js
+++ b/web/app/static/js/nopaque/lists/CorpusList.js
@@ -3,7 +3,6 @@ class CorpusList extends RessourceList {
super(listElement, {...CorpusList.options, ...options});
this.corpora = undefined;
this.user.eventListeners.corpus.addEventListener((eventType, payload) => this.eventHandler(eventType, payload));
- listElement.addEventListener('click', event => this.onclick(event));
}
init(corpora) {
diff --git a/web/app/static/js/nopaque/lists/JobInputList.js b/web/app/static/js/nopaque/lists/JobInputList.js
index c24f6fbe..91f54a99 100644
--- a/web/app/static/js/nopaque/lists/JobInputList.js
+++ b/web/app/static/js/nopaque/lists/JobInputList.js
@@ -3,7 +3,6 @@ class JobInputList extends RessourceList {
super(listElement, {...JobInputList.options, ...options});
this.job = undefined;
this.user.eventListeners.job.addEventListener((eventType, payload) => this.eventHandler(eventType, payload), listElement.dataset.jobId);
- listElement.addEventListener('click', event => this.onclick(event));
}
init(job) {
diff --git a/web/app/static/js/nopaque/lists/JobList.js b/web/app/static/js/nopaque/lists/JobList.js
index b4cd84ff..e80346f4 100644
--- a/web/app/static/js/nopaque/lists/JobList.js
+++ b/web/app/static/js/nopaque/lists/JobList.js
@@ -2,7 +2,6 @@ class JobList extends RessourceList {
constructor(listElement, options = {}) {
super(listElement, {...JobList.options, ...options});
this.user.eventListeners.job.addEventListener((eventType, payload) => this.eventHandler(eventType, payload));
- listElement.addEventListener('click', event => this.onclick(event));
}
onclick(event) {
diff --git a/web/app/static/js/nopaque/lists/JobResultList.js b/web/app/static/js/nopaque/lists/JobResultList.js
index cd42b702..765588a3 100644
--- a/web/app/static/js/nopaque/lists/JobResultList.js
+++ b/web/app/static/js/nopaque/lists/JobResultList.js
@@ -3,7 +3,6 @@ class JobResultList extends RessourceList {
super(listElement, {...JobResultList.options, ...options});
this.job = undefined;
this.user.eventListeners.job.addEventListener((eventType, payload) => this.eventHandler(eventType, payload), listElement.dataset.jobId);
- listElement.addEventListener('click', event => this.onclick(event));
}
init(job) {
diff --git a/web/app/static/js/nopaque/lists/QueryResultList.js b/web/app/static/js/nopaque/lists/QueryResultList.js
index 98f3e7fb..862b530e 100644
--- a/web/app/static/js/nopaque/lists/QueryResultList.js
+++ b/web/app/static/js/nopaque/lists/QueryResultList.js
@@ -2,7 +2,6 @@ class QueryResultList extends RessourceList {
constructor(listElement, options = {}) {
super(listElement, {...QueryResultList.options, ...options});
this.user.eventListeners.queryResult.addEventListener((eventType, payload) => this.eventHandler(eventType, payload));
- listElement.addEventListener('click', event => this.onclick(event));
}
onclick(event) {
diff --git a/web/app/static/js/nopaque/lists/RessourceList.js b/web/app/static/js/nopaque/lists/RessourceList.js
index ec5afa69..d1f7301f 100644
--- a/web/app/static/js/nopaque/lists/RessourceList.js
+++ b/web/app/static/js/nopaque/lists/RessourceList.js
@@ -39,6 +39,7 @@ class RessourceList {
`;
+ if (typeof this.onclick === 'function') {this.list.list.addEventListener('click', event => this.onclick(event));}
}
eventHandler(eventType, payload) {