Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const m = require("mithril").default;
- const UIkit = require('uikit');
- const v = require('./view');
- var currentEvent = {};
- function loadEvent(id) {
- return m.request({
- method: "GET",
- url: '/api/v1/event/' + id,
- }).then(function(result) {
- currentEvent = result;
- });
- }
- module.exports = {
- oninit: function(vnode) {
- loadEvent(vnode.attrs.id);
- console.log('event init');
- },
- view: function() {
- return m('div.uk-container uk-container-small', [
- m('div.uk-container-small', [m('button.uk-button uk-button-primary uk-float-right', {
- onclick: function(vnode) {
- console.log('cli');
- loadEvent(0);
- m.route.set('/event/0', '');
- }
- }, 'New'),
- m('h3.uk-header uk-float-left', 'Event')]),
- m('div.uk-section-xsmall uk-clearfix', m(v.print_view, currentEvent)),
- m('button.uk-button uk-button-primary uk-float-right', 'Save'),
- m('div.uk-section-xsmall uk-clearfix', ''),
- ]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement