From 5ed924e686d4abe666c248586e165b2ccb5dd434 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 2 May 2019 17:55:59 +0900 Subject: [PATCH] Improve MisskeyPages --- locales/ja-JP.yml | 6 ++ .../app/common/scripts/collect-page-vars.ts | 6 ++ .../page-editor/els/page-editor.el.button.vue | 2 +- .../els/page-editor.el.counter.vue | 42 ++++++++ .../page-editor/els/page-editor.el.if.vue | 29 +---- .../page-editor/els/page-editor.el.image.vue | 2 +- .../els/page-editor.el.number-input.vue | 2 +- .../page-editor/els/page-editor.el.post.vue | 6 +- .../els/page-editor.el.section.vue | 29 +---- .../page-editor/els/page-editor.el.switch.vue | 2 +- .../els/page-editor.el.text-input.vue | 2 +- .../page-editor/els/page-editor.el.text.vue | 2 +- .../els/page-editor.el.textarea-input.vue | 2 +- .../els/page-editor.el.textarea.vue | 2 +- .../page-editor/page-editor.block.vue | 33 ------ .../page-editor/page-editor.blocks.vue | 65 ++++++++++++ .../page-editor/page-editor.container.vue | 12 ++- .../components/page-editor/page-editor.vue | 30 +----- .../common/views/pages/page/page.block.vue | 3 +- .../common/views/pages/page/page.counter.vue | 47 ++++++++ src/misc/aiscript/evaluator.ts | 100 +++++++++--------- 21 files changed, 248 insertions(+), 176 deletions(-) create mode 100644 src/client/app/common/views/components/page-editor/els/page-editor.el.counter.vue delete mode 100644 src/client/app/common/views/components/page-editor/page-editor.block.vue create mode 100644 src/client/app/common/views/components/page-editor/page-editor.blocks.vue create mode 100644 src/client/app/common/views/pages/page/page.counter.vue diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index a8a5cbafd..5d85819d5 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1915,6 +1915,12 @@ pages: text: "タイトル" default: "デフォルト値" + counter: "カウンター" + _counter: + name: "変数名" + text: "タイトル" + inc: "増加値" + _button: text: "タイトル" action: "ボタンを押したときの動作" diff --git a/src/client/app/common/scripts/collect-page-vars.ts b/src/client/app/common/scripts/collect-page-vars.ts index 683f9b73a..4c40d5d88 100644 --- a/src/client/app/common/scripts/collect-page-vars.ts +++ b/src/client/app/common/scripts/collect-page-vars.ts @@ -26,6 +26,12 @@ export function collectPageVars(content) { type: 'boolean', value: x.default || false }); + } else if (x.type === 'counter') { + pageVars.push({ + name: x.name, + type: 'number', + value: 0 + }); } else if (x.children) { collect(x.children); } diff --git a/src/client/app/common/views/components/page-editor/els/page-editor.el.button.vue b/src/client/app/common/views/components/page-editor/els/page-editor.el.button.vue index 3e2d3fe19..f89279f05 100644 --- a/src/client/app/common/views/components/page-editor/els/page-editor.el.button.vue +++ b/src/client/app/common/views/components/page-editor/els/page-editor.el.button.vue @@ -1,5 +1,5 @@