Commit fde602bc authored by Christian H's avatar Christian H
Browse files

study docs 'add button' fixed, edit page imprufed (raw), bug fixes

parent 952d8a1f
......@@ -45,4 +45,5 @@ m.route(root, '/events', {
'/joboffers/:id': layoutWith(JobItem),
'/studydocuments': layoutWith(StudydocTable),
'/studydocuments/:id': layoutWith(studydocItem),
'/newstudydocument': layoutWith(studydocItem),
});
import m from 'mithril';
import { RadioGroup } from 'polythene-mithril';
import EditView from '../views/editView';
......@@ -7,9 +8,48 @@ export default class editDoc extends EditView {
return this.layout([
m('h3', 'Add a New Studydocument'),
...this.form.renderPage({
title: { type: 'text', label: 'Title' },
author: { type: 'text', label: 'Author' },
files: [{ type: 'text', label: 'File' }], // buggy
lecture: { type: 'text', label: 'Lecture' },
title: { type: 'text', label: 'Title' },
professor: { type: 'text', label: 'Professor' },
course_year: { type: 'number', lable: 'Year', limit_min: '1990' }, // buggy
}),
// department //drop-down-list
m(RadioGroup, {
name: 'semester',
label: 'Semester',
buttons: [
{ value: '1', label: '1.', defaultChecked: this.form.data.gender === '1' },
{ value: '2', label: '2', defaultChecked: this.form.data.gender === '2' },
{ value: '3', label: '3', defaultChecked: this.form.data.gender === '3' },
{ value: '4', label: '4', defaultChecked: this.form.data.gender === '4' },
{ value: '5', label: '5+', defaultChecked: this.form.data.gender === '5' },
],
onChange: ({ value }) => { console.log(value); this.form.data.gender = value; },
}),
m(RadioGroup, {
name: 'type',
buttons: [{
value: 'exames',
label: 'exames',
defaultChecked: this.form.data.gender === 'exames',
}, {
value: 'cheat_sheet',
label: 'cheat sheet',
defaultChecked: this.form.data.gender === 'cheat_sheet',
}, {
value: 'lecture_documents',
label: 'lecture documents',
defaultChecked: this.form.data.gender === 'lecture_documents',
}, {
value: 'exercise',
label: 'exercise',
defaultChecked: this.form.data.gender === 'exercise',
}],
onChange: ({ value }) => { console.log(value); this.form.data.gender = value; },
}),
]);
}
}
......@@ -43,3 +43,4 @@ export default class viewDoc extends ItemView {
]));
}
}
......@@ -42,7 +42,7 @@ export default class UserEdit extends EditView {
m(RadioGroup, {
name: 'Sex',
buttons: [
{ value: 'female', label: 'Female', defaultChecked: this.data.gender === 'female' },
{ value: 'female', label: 'Female', defaultChecked: this.form.data.gender === 'female' },
{ value: 'male', label: 'Male', defaultChecked: this.form.data.gender === 'male' },
],
onChange: ({ value }) => { console.log(value); this.form.data.gender = value; },
......
......@@ -56,17 +56,17 @@ export default class UserView extends ItemView {
...stdMargin,
}, 'Regular Member');
} else if (this.data.membership === 'extraordinary') {
membership = m(
chip,
{ svg: icons.checked, svgBackground: colors.green, ...stdMargin },
'Extraordinary Member',
);
membership = m(chip, {
svg: icons.checked,
svgBackground: colors.green,
...stdMargin,
}, 'Extraordinary Member');
} else if (this.data.membership === 'honorary') {
membership = m(
chip,
{ svg: icons.star, svgBackground: colors.orange, ...stdMargin },
'Honorary Member',
);
membership = m(chip, {
svg: icons.star,
svgBackground: colors.orange,
...stdMargin,
}, 'Honorary Member');
}
// Selector that is only displayed if "new" is clicked in the
......
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