filo_caspar/app/controller/components.js

81 lines
2.3 KiB
JavaScript
Raw Normal View History

2016-04-14 04:01:51 +00:00
const m = require('mithril')
exports.error = function(error) {
if (!error) return null
return m('div.error-box', error)
}
2016-07-28 18:21:50 +00:00
exports.presetOnlyList = function(vm) {
return [
m('label', 'Presets'),
m('ul.panel-graphic-preset', vm.presets.map((item, index) =>
m('li', { key: index }, [
m('.row', { key: index }, [
m('div', { class: 'small-8 columns panel-graphic-property-item' },
m('input[type=text]', {
readonly: true,
value: item.values[graphic.settings.main],
})
),
2016-07-28 18:41:43 +00:00
m('div', { class: 'small-4 columns' },
[
m('a.panel-graphic-preset-remove.button.success', {
onclick: vm.displayPreset.bind(vm, item),
}, 'Display'),
m('a.panel-graphic-preset-remove.button.alert', {
onclick: vm.removePreset.bind(vm, item),
}, 'X')
]
2016-07-28 18:21:50 +00:00
),
])
])
))
]
}
exports.presetButtons = function(vm) {
return [
m('a.panel-graphic-preset-add.button', {
onclick: vm.addPreset.bind(vm),
2016-07-28 18:41:43 +00:00
}, 'Save Preset'),
2016-07-28 18:21:50 +00:00
m('a.panel-graphic-display.success.button', {
onclick: vm.displayCurrent.bind(vm),
2016-07-28 18:41:43 +00:00
}, 'Display Live'),
2016-07-28 18:21:50 +00:00
]
}
2016-04-14 04:01:51 +00:00
exports.presetList = function(vm) {
return [
m('a.panel-graphic-preset-add.button', {
onclick: vm.addPreset.bind(vm),
2016-07-17 10:44:57 +00:00
}, 'Save Preset'),
2016-04-14 04:01:51 +00:00
m('a.panel-graphic-display.success.button', {
onclick: vm.displayCurrent.bind(vm),
2016-07-17 10:44:57 +00:00
}, 'Display Live'),
2016-04-14 04:01:51 +00:00
m('label', 'Presets'),
m('ul.panel-graphic-preset', vm.presets.map((item, index) =>
m('li', { key: index }, [
m('.row', { key: index }, [
m('div', { class: 'small-8 columns panel-graphic-property-item' },
m('input[type=text]', {
readonly: true,
value: item.values[graphic.settings.main],
})
),
2016-07-17 10:44:57 +00:00
m('div', { class: 'small-4 columns' },
[
m('a.panel-graphic-preset-remove.button.success', {
onclick: vm.displayPreset.bind(vm, item),
}, 'Display'),
m('a.panel-graphic-preset-remove.button.alert', {
onclick: vm.removePreset.bind(vm, item),
}, 'X')
]
2016-04-14 04:01:51 +00:00
),
])
])
))
]
}