mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 09:15:41 +00:00
33 lines
767 B
JavaScript
33 lines
767 B
JavaScript
class RessourceDisplay {
|
|
constructor(displayElement) {
|
|
this.displayElement = displayElement;
|
|
this.userId = this.displayElement.dataset.userId;
|
|
app.addEventListener('users.patch', patch => this.usersPatchHandler(patch));
|
|
app.getUserById(this.userId).then(user => this.init(user));
|
|
}
|
|
|
|
init(user) {throw 'Not implemented';}
|
|
|
|
usersPatchHandler(patch) {throw 'Not implemented';}
|
|
|
|
setElement(element, value) {
|
|
switch (element.tagName) {
|
|
case 'INPUT':
|
|
element.value = value;
|
|
M.updateTextFields();
|
|
break;
|
|
default:
|
|
element.innerText = value;
|
|
break;
|
|
}
|
|
}
|
|
|
|
setElements(elements, value) {
|
|
let element;
|
|
|
|
for (element of elements) {
|
|
this.setElement(element, value);
|
|
}
|
|
}
|
|
}
|