To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 84bfe1b8 authored by Hermann's avatar Hermann
Browse files

activate upcoming events filter per default

parent 8effc790
......@@ -42,6 +42,8 @@ export default class EventTable {
name: 'past',
query: { time_start: { $lt: `${now.toISOString().slice(0, -5)}Z` } },
}]],
// per default, enable the 'upcoming' filter
initFilterIdxs: [[0, 0]],
onAdd: () => { m.route.set('/newevent'); },
});
}
......
......@@ -43,25 +43,25 @@ export default class UserView extends ItemView {
let membership = m(chip, {
svg: icons.clear,
background: colors.amiv_red,
svgBackground: colors.amiv_red,
...stdMargin,
}, 'No Member');
if (this.data.membership === 'regular') {
membership = m(chip, {
svg: icons.checked,
background: colors.green,
svgBackground: colors.green,
...stdMargin,
}, 'Regular Member');
} else if (this.data.membership === 'extraordinary') {
membership = m(
chip,
{ svg: icons.checked, background: colors.green, ...stdMargin },
{ svg: icons.checked, svgBackground: colors.green, ...stdMargin },
'Extraordinary Member',
);
} else if (this.data.membership === 'honorary') {
membership = m(
chip,
{ svg: icons.star, background: colors.orange, ...stdMargin },
{ svg: icons.star, svgBackground: colors.orange, ...stdMargin },
'Honorary Member',
);
}
......@@ -124,6 +124,8 @@ export default class UserView extends ItemView {
name: 'past',
query: { time_start: { $lt: `${now.toISOString().slice(0, -5)}Z` } },
}]],
// per default, enable the 'upcoming' filter
initFilterIdxs: [[0, 0]],
}),
]),
})),
......
......@@ -71,6 +71,20 @@ export default class TableView {
filterGroup.map(filter => Object.assign({}, filter))) : null;
}
/*
* initFilterIdxs lets you specify the filters that are active at initialization.
* They are specified as index to the nexted filterGroups array.
*/
oninit({ attrs: { controller, initFilterIdxs = [] } }) {
if (this.filters) {
initFilterIdxs.forEach((filterIdx) => {
this.filters[filterIdx[0]][filterIdx[1]].selected = true;
});
// update filters in controller
controller.setFilter(this.getSelectedFilterQuery());
}
}
getItemData(data) {
return this.tableKeys.map((key) => {
// Access a nested key, indicated by dot-notation
......
Markdown is supported
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