Commit b4468c47 authored by Sandro Lutz's avatar Sandro Lutz
Browse files

Add search field for group self-enrollment (Resolves #9)

parent b94ce712
......@@ -222,16 +222,36 @@ class groupMemberships {
groups.loadMemberships();
this.busy = [];
this.confirm = [];
this.query = '';
}
view() {
// Searchbar for groups
const filterForm = m('div', [
m(inputGroup, {
name: 'group_search',
title: 'Search groups',
oninput: e => {
this.query = e.target.value;
if (this.query.length > 0) {
this.isValid = true;
}
},
}),
]);
return m('div', [
filterForm,
m(
'div',
groups.getMemberships().map(membership => {
const buttonArgs = {};
let buttons;
if (this.query.length > 0 && !new RegExp(this.query, 'gi').test(membership.group.name)) {
return m('');
}
if (this.busy[membership.group._id]) {
buttonArgs.disabled = true;
}
......@@ -295,8 +315,13 @@ class groupMemberships {
'div',
groups.getList().map(group => {
if (groups.getMemberships().some(element => element.group._id === group._id)) {
return m.trust('');
return m('');
}
if (this.query.length > 0 && !new RegExp(this.query, 'gi').test(group.name)) {
return m('');
}
const buttonArgs = {
events: {
onclick: () => {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment