From 0c092b8050a099d1ada717102222aebe6f53b8d8 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 22 Feb 2018 02:22:10 +0900 Subject: [PATCH] wip --- src/web/app/mobile/api/post.ts | 32 ++++++++++++++++++++------------ src/web/app/mobile/script.ts | 2 +- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/web/app/mobile/api/post.ts b/src/web/app/mobile/api/post.ts index 3ceb10496..3b14e0c1d 100644 --- a/src/web/app/mobile/api/post.ts +++ b/src/web/app/mobile/api/post.ts @@ -1,26 +1,34 @@ import PostForm from '../views/components/post-form.vue'; -import RepostForm from '../views/components/repost-form.vue'; +//import RepostForm from '../views/components/repost-form.vue'; +import getPostSummary from '../../../../common/get-post-summary'; -export default function(opts) { +export default (os) => (opts) => { const o = opts || {}; - const app = document.getElementById('app'); - app.style.display = 'none'; - - function recover() { - app.style.display = 'block'; - } - if (o.repost) { - const vm = new RepostForm({ + /*const vm = new RepostForm({ propsData: { repost: o.repost } }).$mount(); vm.$once('cancel', recover); vm.$once('post', recover); - document.body.appendChild(vm.$el); + document.body.appendChild(vm.$el);*/ + + const text = window.prompt(`「${getPostSummary(o.repost)}」をRepost`); + if (text == null) return; + os.api('posts/create', { + repost_id: o.repost.id, + text: text == '' ? undefined : text + }); } else { + const app = document.getElementById('app'); + app.style.display = 'none'; + + function recover() { + app.style.display = 'block'; + } + const vm = new PostForm({ propsData: { reply: o.reply @@ -30,4 +38,4 @@ export default function(opts) { vm.$once('post', recover); document.body.appendChild(vm.$el); } -} +}; diff --git a/src/web/app/mobile/script.ts b/src/web/app/mobile/script.ts index 1d25280d9..89a21631e 100644 --- a/src/web/app/mobile/script.ts +++ b/src/web/app/mobile/script.ts @@ -38,7 +38,7 @@ init((launch) => { chooseDriveFile, dialog, input, - post, + post: post(os), notify }));