Skip to content
Snippets Groups Projects
Commit 8482c15e authored by Lionel Trebuchon's avatar Lionel Trebuchon
Browse files

Merge branch 'codingweekendfs18' of https://gitlab.ethz.ch/amiv/amiv-admintool...

Merge branch 'codingweekendfs18' of https://gitlab.ethz.ch/amiv/amiv-admintool into codingweekendfs18
parents 1744113f 784afc68
No related branches found
No related tags found
No related merge requests found
import m from 'mithril';
import { Checkbox, Button, Card, TextField, IconButton, Toolbar, ToolbarTitle } from 'polythene-mithril';
import { Switch, Button, Card, TextField, IconButton, Toolbar, ToolbarTitle, MaterialDesignSpinner as Spinner } from 'polythene-mithril';
import ItemView from '../views/itemView';
import { events as config, eventsignups as signupConfig } from '../config.json';
import TableView from '../views/tableView';
......@@ -7,12 +7,13 @@ import DatalistController from '../listcontroller';
import { dateFormatter } from '../utils';
import { icons } from '../views/elements';
import { styler } from 'polythene-core-css';
import {ResourceHandler} from "../auth";
const viewLayout = [
{
'.eventViewContainer': {
display: 'grid',
'grid-template-columns': '50% 50%',
'grid-template-columns': '40% 55%',
'grid-gap': '50px',
},
'.eventViewLeft': {
......@@ -63,12 +64,40 @@ class ParticipantsTable {
}
}
class EmailList {
view({ attrs: { list } }) {
const emails = list.toString().replace(/,/g, '; ');
return m(Card, {
content: m(TextField, { value: emails, label: '', multiLine: true }, ''),
});
}
}
export default class viewEvent extends ItemView {
constructor() {
super('events');
this.signupHandler = new ResourceHandler('eventsignups');
this.details = false;
this.waitlist = false;
this.emailAdresses = false;
this.emaillist = [''];
this.showAllEmails = false;
this.setUpEmailList(this.showAllEmails);
}
setUpEmailList(showAll) {
if (!showAll) {
this.signupHandler.get({ where: { accepted: true } }).then((data) => {
this.emaillist = (data._items.map(item => item.email));
});
}
else {
this.signupHandler.get({}).then((data) => {
this.emaillist = (data._items.map(item => item.email));
});
}
m.redraw();
}
view() {
......@@ -112,10 +141,6 @@ export default class viewEvent extends ItemView {
m(IconButton, { icon: { svg: m.trust(icons.ArrowRight) } }),
m(ToolbarTitle, { text: "details" }),
]);
let displayWaitlistButton = m(Toolbar, { compact: true, events: { onclick: () => this.waitlist = !this.waitlist } }, [
m(IconButton, { icon: { svg: m.trust(icons.ArrowRight) } }),
m(ToolbarTitle, { text: "waitlist" }),
]);
let displayEmailAdressesButton = m(Toolbar, { compact: true, events: { onclick: () => this.emailAdresses = !this.emailAdresses } }, [
m(IconButton, { icon: { svg: m.trust(icons.ArrowRight) } }),
m(ToolbarTitle, { text: "email adresses" }),
......@@ -184,40 +209,6 @@ export default class viewEvent extends ItemView {
})
}
if (this.waitlist) {
displayWaitlistButton = m(Toolbar, { compact: true, events: { onclick: () => this.waitlist = !this.waitlist } }, [
m(IconButton, { icon: { svg: m.trust(icons.ArrowDown) } }),
m(ToolbarTitle, { text: "waitlist" }),
]);
displayWaitlist = m(Card, {
content: [
{
primary: {
title: "Primary title",
subtitle: "Subtitle"
}
},
{
actions: {
content: [
m(Button, {
label: "Action 1"
}),
m(Button, {
label: "Action 2"
})
]
}
},
{
text: {
content: "More text"
}
}
]
})
}
if (this.emailAdresses) {
displayEmailAdressesButton = m(Toolbar, { compact: true, events: { onclick: () => this.emailAdresses = !this.emailAdresses } }, [
......@@ -227,31 +218,28 @@ export default class viewEvent extends ItemView {
displayEmailAdresses = m(Card, {
content: [
{
primary: {
title: "Primary title",
subtitle: "Subtitle"
}
},
{
actions: {
content: [
m(Button, {
label: "Action 1"
any:
{
content: m(Switch, {
defaultChecked: false,
label: 'show unaccepted',
onChange: () => {
this.showAllEmails = !this.showAllEmails;
this.setUpEmailList(this.showAllEmails);
},
}),
m(Button, {
label: "Action 2"
})
]
}
},
},
{
text: {
content: "More text"
}
}
]
any:
{
content: m(EmailList, { list: this.emaillist }),
}
},
],
})
});
}
......@@ -266,9 +254,6 @@ export default class viewEvent extends ItemView {
displayDetailsButton,
displayDetails,
displayWaitlistButton,
displayWaitlist,
displayEmailAdressesButton,
displayEmailAdresses,
]),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment