From 7921d3508a57e5d711a5d4a99b2a9f6b395c92ff Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 21 Feb 2017 09:59:53 +0900 Subject: [PATCH] wip --- src/web/app/desktop/tags/input-dialog.tag | 28 ++++++++++++++--------- src/web/app/mobile/tags/home.tag | 2 ++ 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/web/app/desktop/tags/input-dialog.tag b/src/web/app/desktop/tags/input-dialog.tag index aa417f0a7..f343c4625 100644 --- a/src/web/app/desktop/tags/input-dialog.tag +++ b/src/web/app/desktop/tags/input-dialog.tag @@ -133,29 +133,35 @@ this.text.focus(); this.refs.window.on('closing', () => { - if @done - this.opts.on-ok @text.value - else - if this.opts.on-cancel? - this.opts.on-cancel! + if (this.done) { + this.opts.onOk(this.text.value); + } else { + if (this.opts.onCancel) this.opts.onCancel(); + } + }); this.refs.window.on('closed', () => { this.unmount(); }); + }); this.cancel = () => { - this.done = false + this.done = false; this.refs.window.close(); + }; this.ok = () => { - if not @allow-empty and @text.value == '' then return - this.done = true + if (!this.allowEmpty && this.text.value == '') return; + this.done = true; this.refs.window.close(); + }; - this.onKeydown = (e) => { - if e.which == 13 // Enter + this.onKeydown = e => { + if (e.which == 13) { // Enter e.preventDefault(); e.stopPropagation(); - @ok! + this.ok(); + } + }; diff --git a/src/web/app/mobile/tags/home.tag b/src/web/app/mobile/tags/home.tag index 0ca62cdb0..2edfd656e 100644 --- a/src/web/app/mobile/tags/home.tag +++ b/src/web/app/mobile/tags/home.tag @@ -16,5 +16,7 @@ this.on('mount', () => { this.refs.tl.on('loaded', () => { this.trigger('loaded'); + }); + });