filo_caspar/app/controller/graphic/view.js

29 lines
822 B
JavaScript
Raw Normal View History

2016-04-14 04:01:51 +00:00
const m = require('mithril')
const Graphic = require('./controller')
const components = require('../components')
const engines = {
text: require('./engine/text'),
countdown: require('./engine/countdown'),
2016-07-28 18:21:50 +00:00
schedule: require('./engine/schedule'),
2016-04-14 04:01:51 +00:00
}
Graphic.view = function(ctrl) {
graphic = Graphic.vm.graphic
return m('div', [
m('h3.container-header', 'Graphic'),
m('div.container-panel.panel-graphic',
!graphic.name && m('p', 'Loading...') ||
[
m('a.panel-graphic-settings.button', {
onclick: Graphic.vm.switchView
}, Graphic.vm.currentView === 'view' && 'Settings' || 'Control'),
m('h4', graphic.name),
components.error(Graphic.vm.error),
engines[graphic.engine][Graphic.vm.currentView](ctrl, graphic, Graphic.vm),
]
),
])
}