✌️
This commit is contained in:
parent
bb507d0be1
commit
d9e90e97f8
23
src/web/app/mobile/mixins.js
Normal file
23
src/web/app/mobile/mixins.js
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
const riot = require('riot');
|
||||||
|
|
||||||
|
module.exports = me => {
|
||||||
|
if (me) {
|
||||||
|
require('./scripts/stream.ls')(me);
|
||||||
|
}
|
||||||
|
|
||||||
|
require('./scripts/ui.ls');
|
||||||
|
|
||||||
|
riot.mixin('open-post-form', {
|
||||||
|
openPostForm: opts => {
|
||||||
|
const app = document.getElementById('app');
|
||||||
|
app.style.display = 'none';
|
||||||
|
const form = riot.mount(document.body.appendChild(document.createElement('mk-post-form')), opts)[0];
|
||||||
|
function recover() {
|
||||||
|
app.style.display = 'block';
|
||||||
|
}
|
||||||
|
form
|
||||||
|
.on('cancel', recover)
|
||||||
|
.on('post', recover);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
|
@ -1,19 +0,0 @@
|
||||||
riot = require \riot
|
|
||||||
|
|
||||||
module.exports = (me) ~>
|
|
||||||
if me?
|
|
||||||
(require './scripts/stream.ls') me
|
|
||||||
|
|
||||||
require './scripts/ui.ls'
|
|
||||||
|
|
||||||
riot.mixin \open-post-form do
|
|
||||||
open-post-form: (opts) ->
|
|
||||||
app = document.get-element-by-id \app
|
|
||||||
app.style.display = \none
|
|
||||||
form = document.body.append-child document.create-element \mk-post-form
|
|
||||||
form = riot.mount form, opts .0
|
|
||||||
form.on \cancel recover
|
|
||||||
form.on \post recover
|
|
||||||
|
|
||||||
function recover
|
|
||||||
app.style.display = \block
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
require('./tags');
|
require('./tags');
|
||||||
const boot = require('../boot.js');
|
const boot = require('../boot.js');
|
||||||
const mixins = require('./mixins.ls');
|
const mixins = require('./mixins');
|
||||||
const route = require('./router.ls');
|
const route = require('./router.ls');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue