diff --git a/web/app/static/js/nopaque/lists/Userlist.js b/web/app/static/js/nopaque/lists/Userlist.js new file mode 100644 index 00000000..c1abce8f --- /dev/null +++ b/web/app/static/js/nopaque/lists/Userlist.js @@ -0,0 +1,71 @@ +class UserList extends RessourceList { + constructor(listElement, options = {}) { + super(listElement, {...UserList.options, ...options}); + users = undefined; + } + + init(users) { + this.users = users; + super.init(users); + } + + onclick(event) { + let ressourceElement = event.target.closest('tr'); + if (ressourceElement === null) {return;} + let userId = ressourceElement.dataset.id; + let actionButtonElement = event.target.closest('.action-button'); + let action = (actionButtonElement === null) ? 'view' : actionButtonElement.dataset.action; + switch (action) { + case 'delete': + let deleteModalHTML = `