2016-04-10 08:37:05 +00:00
|
|
|
const m = require('mithril')
|
2016-04-14 04:01:51 +00:00
|
|
|
const createModule = require('./module')
|
2016-04-10 08:37:05 +00:00
|
|
|
|
2016-04-14 04:01:51 +00:00
|
|
|
const Menu = createModule({
|
|
|
|
init: function() {
|
|
|
|
this.monitor('list', 'graphic.all', [])
|
|
|
|
}
|
|
|
|
}, function(ctrl) {
|
|
|
|
return m('div', [
|
|
|
|
m('h3.container-header', 'Graphics'),
|
|
|
|
m('div.container-panel.menu', [
|
|
|
|
m('ul.menu-list', [
|
|
|
|
// m('a', { href: `/`, config: m.route }, 'Home'),
|
|
|
|
Menu.vm.list.map((item) =>
|
|
|
|
m('li.menu-item', [
|
|
|
|
m('a', { href: `/graphic/${item.id}`, config: m.route }, item.name),
|
|
|
|
])
|
|
|
|
)
|
2016-04-10 08:37:05 +00:00
|
|
|
]),
|
2016-04-14 04:01:51 +00:00
|
|
|
m('a.menu-item-add', { href: '/add', config: m.route }, 'Add graphic' ),
|
|
|
|
]),
|
|
|
|
])
|
|
|
|
})
|
2016-04-10 08:37:05 +00:00
|
|
|
module.exports = Menu
|