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 { ...@@ -42,6 +42,8 @@ export default class EventTable {
name: 'past', name: 'past',
query: { time_start: { $lt: `${now.toISOString().slice(0, -5)}Z` } }, query: { time_start: { $lt: `${now.toISOString().slice(0, -5)}Z` } },
}]], }]],
// per default, enable the 'upcoming' filter
initFilterIdxs: [[0, 0]],
onAdd: () => { m.route.set('/newevent'); }, onAdd: () => { m.route.set('/newevent'); },
}); });
} }
......
...@@ -43,25 +43,25 @@ export default class UserView extends ItemView { ...@@ -43,25 +43,25 @@ export default class UserView extends ItemView {
let membership = m(chip, { let membership = m(chip, {
svg: icons.clear, svg: icons.clear,
background: colors.amiv_red, svgBackground: colors.amiv_red,
...stdMargin, ...stdMargin,
}, 'No Member'); }, 'No Member');
if (this.data.membership === 'regular') { if (this.data.membership === 'regular') {
membership = m(chip, { membership = m(chip, {
svg: icons.checked, svg: icons.checked,
background: colors.green, svgBackground: colors.green,
...stdMargin, ...stdMargin,
}, 'Regular Member'); }, 'Regular Member');
} else if (this.data.membership === 'extraordinary') { } else if (this.data.membership === 'extraordinary') {
membership = m( membership = m(
chip, chip,
{ svg: icons.checked, background: colors.green, ...stdMargin }, { svg: icons.checked, svgBackground: colors.green, ...stdMargin },
'Extraordinary Member', 'Extraordinary Member',
); );
} else if (this.data.membership === 'honorary') { } else if (this.data.membership === 'honorary') {
membership = m( membership = m(
chip, chip,
{ svg: icons.star, background: colors.orange, ...stdMargin }, { svg: icons.star, svgBackground: colors.orange, ...stdMargin },
'Honorary Member', 'Honorary Member',
); );
} }
...@@ -124,6 +124,8 @@ export default class UserView extends ItemView { ...@@ -124,6 +124,8 @@ export default class UserView extends ItemView {
name: 'past', name: 'past',
query: { time_start: { $lt: `${now.toISOString().slice(0, -5)}Z` } }, 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 { ...@@ -71,6 +71,20 @@ export default class TableView {
filterGroup.map(filter => Object.assign({}, filter))) : null; 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) { getItemData(data) {
return this.tableKeys.map((key) => { return this.tableKeys.map((key) => {
// Access a nested key, indicated by dot-notation // 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