Commit 9d025327 authored by chegelba's avatar chegelba
Browse files

itmeView Toolbar: 'X button' added, editDoc imtoved (raw)

parent fde602bc
......@@ -39,7 +39,7 @@ export default class ItemController {
cancel() {
if (this.modus === 'edit') this.changeModus('view');
if (this.modus === 'new') m.route.set(`/${this.resource}`);
else m.route.set(`/${this.resource}`);
}
changeModus(newModus) {
......
......@@ -8,17 +8,18 @@ export default class editDoc extends EditView {
return this.layout([
m('h3', 'Add a New Studydocument'),
...this.form.renderPage({
// uploader
author: { type: 'text', label: 'Author' },
files: [{ type: 'text', label: 'File' }], // buggy
files: { type: 'text', label: 'File' }, // buggy only singel file possible
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
course_year: { type: 'number', lable: 'Year' }, // semester unterscheidung, plausibility
}),
// department //drop-down-list
m('div', 'Semester'), // formatieren
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' },
......
import m from 'mithril';
import { Toolbar, Dialog, Button } from 'polythene-mithril';
import { IconButton, Toolbar, ToolbarTitle, Dialog, Button } from 'polythene-mithril';
import { ButtonCSS } from 'polythene-css';
import { colors } from '../style';
import { loadingScreen } from '../layout';
import { icons } from './elements';
ButtonCSS.addStyle('.itemView-edit-button', {
color_light_background: colors.light_blue,
......@@ -53,21 +54,29 @@ export default class ItemView {
layout(children, buttons = []) {
if (!this.controller || !this.controller.data) return m(loadingScreen);
return m('div', [
m(Toolbar, m('div.pe-button-row', [
m(Button, {
element: 'div',
className: 'itemView-edit-button',
label: `Edit ${this.resource.charAt(0).toUpperCase()}${this.resource.slice(1, -1)}`,
events: { onclick: () => { this.controller.changeModus('edit'); } },
}),
m(Button, {
label: `Delete ${this.resource.charAt(0).toUpperCase()}${this.resource.slice(1, -1)}`,
className: 'itemView-delete-button',
border: true,
events: { onclick: () => this.delete() },
m(Toolbar, [
m('div', { style: { width: 'calc(100% - 48px)' } }, m('div.pe-button-row', [
m(Button, {
element: 'div',
className: 'itemView-edit-button',
label: `Edit ${this.resource.charAt(0).toUpperCase()}${this.resource.slice(1, -1)}`,
events: { onclick: () => { this.controller.changeModus('edit'); } },
}),
m(Button, {
label: `Delete ${this.resource.charAt(0).toUpperCase()}${this.resource.slice(1, -1)}`,
className: 'itemView-delete-button',
border: true,
events: { onclick: () => this.delete() },
}),
...buttons,
])),
m(IconButton, {
style: { 'margin-left': 'auto', 'margin-right': '0px' },
icon: { svg: { content: m.trust(icons.clear) } },
events: { onclick: () => { this.controller.cancel(); } },
}),
...buttons,
])),
]),
m('div', {
style: { height: 'calc(100vh - 130px)', 'overflow-y': 'scroll' },
}, children),
......
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