mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-06-11 16:40:40 +00:00
Update AdminUserList
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
class UserList extends ResourceList {
|
||||
class AdminUserList extends ResourceList {
|
||||
static autoInit() {
|
||||
for (let userListElement of document.querySelectorAll('.user-list:not(.no-autoinit)')) {
|
||||
new UserList(userListElement);
|
||||
for (let adminUserListElement of document.querySelectorAll('.admin-user-list:not(.no-autoinit)')) {
|
||||
new AdminUserList(adminUserListElement);
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,6 +95,7 @@ class UserList extends ResourceList {
|
||||
? 'view' : listActionElement.dataset.listAction;
|
||||
switch (listAction) {
|
||||
case 'delete': {
|
||||
console.log('delete', itemId);
|
||||
Utils.deleteUserRequest(itemId);
|
||||
if (itemId === currentUserId) {window.location.href = '/';}
|
||||
break;
|
@ -13,7 +13,7 @@ class ResourceList {
|
||||
PublicUserList.autoInit();
|
||||
SpaCyNLPPipelineModelList.autoInit();
|
||||
TesseractOCRPipelineModelList.autoInit();
|
||||
UserList.autoInit();
|
||||
AdminUserList.autoInit();
|
||||
}
|
||||
|
||||
static defaultOptions = {
|
||||
@ -24,10 +24,18 @@ class ResourceList {
|
||||
}
|
||||
};
|
||||
|
||||
constructor(listContainerElement, options={}) {
|
||||
if ('items' in options) {throw '"items" is not supported as an option, define it as a getter in the list class';}
|
||||
if ('valueNames' in options) {throw '"valueNames" is not supported as an option, define it as a getter in the list class';}
|
||||
let _options = _.merge({item: this.item, valueNames: this.valueNames}, ResourceList.defaultOptions, options);
|
||||
constructor(listContainerElement, options = {}) {
|
||||
if ('items' in options) {
|
||||
throw '"items" is not supported as an option, define it as a getter in the list class';
|
||||
}
|
||||
if ('valueNames' in options) {
|
||||
throw '"valueNames" is not supported as an option, define it as a getter in the list class';
|
||||
}
|
||||
let _options = Utils.mergeObjectsDeep(
|
||||
{item: this.item, valueNames: this.valueNames},
|
||||
ResourceList.defaultOptions,
|
||||
options
|
||||
);
|
||||
this.listContainerElement = listContainerElement;
|
||||
this.initListContainerElement();
|
||||
this.listjs = new List(listContainerElement, _options);
|
||||
|
Reference in New Issue
Block a user