diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index e2bfb2e896..343d9cfc39 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1842,6 +1842,7 @@ dev/views/new-app.vue: pages: new-page: "ページの作成" edit-page: "ページの編集" + read-page: "ソースを表示中" page-created: "ページを作成しました" page-updated: "ページを更新しました" are-you-sure-delete: "このページを削除しますか?" @@ -1871,6 +1872,9 @@ pages: section: "セクション" image: "画像" button: "ボタン" + if: "もし" + _if: + variable: "変数" input: "ユーザー入力" _input: name: "変数名" diff --git a/src/client/app/common/views/components/page-editor/page-editor.button.vue b/src/client/app/common/views/components/page-editor/els/page-editor.el.button.vue similarity index 93% rename from src/client/app/common/views/components/page-editor/page-editor.button.vue rename to src/client/app/common/views/components/page-editor/els/page-editor.el.button.vue index d5fc243818..3e2d3fe19d 100644 --- a/src/client/app/common/views/components/page-editor/page-editor.button.vue +++ b/src/client/app/common/views/components/page-editor/els/page-editor.el.button.vue @@ -16,9 +16,9 @@ + + diff --git a/src/client/app/common/views/components/page-editor/page-editor.image.vue b/src/client/app/common/views/components/page-editor/els/page-editor.el.image.vue similarity index 89% rename from src/client/app/common/views/components/page-editor/page-editor.image.vue rename to src/client/app/common/views/components/page-editor/els/page-editor.el.image.vue index 0bc1816e8d..5ada8c77ba 100644 --- a/src/client/app/common/views/components/page-editor/page-editor.image.vue +++ b/src/client/app/common/views/components/page-editor/els/page-editor.el.image.vue @@ -15,11 +15,11 @@ diff --git a/src/client/app/common/views/components/page-editor/page-editor.vue b/src/client/app/common/views/components/page-editor/page-editor.vue index 8b25828515..f39985952b 100644 --- a/src/client/app/common/views/components/page-editor/page-editor.vue +++ b/src/client/app/common/views/components/page-editor/page-editor.vue @@ -2,16 +2,16 @@
-
{{ pageId ? $t('edit-page') : $t('new-page') }}
+
{{ readonly ? $t('read-page') : pageId ? $t('edit-page') : $t('new-page') }}
- + - +
- {{ $t('view-page') }} + {{ $t('view-page') }} {{ $t('title') }} @@ -23,7 +23,7 @@ - + {{ $t('url') }} @@ -45,10 +45,10 @@
- +
- +
@@ -70,7 +70,7 @@
- + {{ $t('more-details') }} @@ -106,11 +106,17 @@ export default Vue.extend({ page: { type: String, required: false - } + }, + readonly: { + type: Boolean, + required: false, + default: false + }, }, data() { return { + author: this.$store.state.i, pageId: null, currentName: null, title: '', @@ -157,6 +163,7 @@ export default Vue.extend({ this.$root.api('pages/show', { pageId: this.page, }).then(page => { + this.author = page.user; this.pageId = page.id; this.title = page.title; this.name = page.name; @@ -180,7 +187,9 @@ export default Vue.extend({ provide() { return { - getScriptBlockList: this.getScriptBlockList + readonly: this.readonly, + getScriptBlockList: this.getScriptBlockList, + getPageBlockList: this.getPageBlockList } }, @@ -250,19 +259,7 @@ export default Vue.extend({ type: null, title: this.$t('choose-block'), select: { - items: [{ - value: 'section', text: this.$t('blocks.section') - }, { - value: 'text', text: this.$t('blocks.text') - }, { - value: 'image', text: this.$t('blocks.image') - }, { - value: 'button', text: this.$t('blocks.button') - }, { - value: 'input', text: this.$t('blocks.input') - }, { - value: 'switch', text: this.$t('blocks.switch') - }] + items: this.getPageBlockList() }, showCancelButton: true }); @@ -324,6 +321,24 @@ export default Vue.extend({ this.variables = newValue; }, + getPageBlockList() { + return [{ + value: 'section', text: this.$t('blocks.section') + }, { + value: 'text', text: this.$t('blocks.text') + }, { + value: 'image', text: this.$t('blocks.image') + }, { + value: 'button', text: this.$t('blocks.button') + }, { + value: 'input', text: this.$t('blocks.input') + }, { + value: 'switch', text: this.$t('blocks.switch') + }, { + value: 'if', text: this.$t('blocks.if') + }]; + }, + getScriptBlockList(type: string = null) { const list = []; @@ -436,6 +451,7 @@ export default Vue.extend({ > .view display inline-block margin 16px 0 0 0 + font-size 14px > .content margin-bottom 16px diff --git a/src/client/app/common/views/pages/page/page.block.vue b/src/client/app/common/views/pages/page/page.block.vue index 48a89f9de7..e3a758ed4e 100644 --- a/src/client/app/common/views/pages/page/page.block.vue +++ b/src/client/app/common/views/pages/page/page.block.vue @@ -10,10 +10,11 @@ import XImage from './page.image.vue'; import XButton from './page.button.vue'; import XInput from './page.input.vue'; import XSwitch from './page.switch.vue'; +import XIf from './page.if.vue'; export default Vue.extend({ components: { - XText, XSection, XImage, XButton, XInput, XSwitch + XText, XSection, XImage, XButton, XInput, XSwitch, XIf }, props: { diff --git a/src/client/app/common/views/pages/page/page.button.vue b/src/client/app/common/views/pages/page/page.button.vue index 5063d27122..b77d856d5d 100644 --- a/src/client/app/common/views/pages/page/page.button.vue +++ b/src/client/app/common/views/pages/page/page.button.vue @@ -1,6 +1,6 @@ diff --git a/src/client/app/common/views/pages/page/page.if.vue b/src/client/app/common/views/pages/page/page.if.vue new file mode 100644 index 0000000000..9dbeaf64fb --- /dev/null +++ b/src/client/app/common/views/pages/page/page.if.vue @@ -0,0 +1,30 @@ + + + diff --git a/src/client/app/common/views/pages/page/page.input.vue b/src/client/app/common/views/pages/page/page.input.vue index cda5550337..9f4cfd91f3 100644 --- a/src/client/app/common/views/pages/page/page.input.vue +++ b/src/client/app/common/views/pages/page/page.input.vue @@ -1,6 +1,6 @@ diff --git a/src/client/app/common/views/pages/page/page.switch.vue b/src/client/app/common/views/pages/page/page.switch.vue index 962ab84bb5..d36ecbfba1 100644 --- a/src/client/app/common/views/pages/page/page.switch.vue +++ b/src/client/app/common/views/pages/page/page.switch.vue @@ -1,6 +1,6 @@ diff --git a/src/client/app/common/views/pages/page/page.vue b/src/client/app/common/views/pages/page/page.vue index e7e8f76d53..7cbd3ed81b 100644 --- a/src/client/app/common/views/pages/page/page.vue +++ b/src/client/app/common/views/pages/page/page.vue @@ -38,6 +38,7 @@ class Script { } public interpolate(str: string) { + if (str == null) return null; return str.replace(/\{(.+?)\}/g, match => { const v = this.vars.find(x => x.name === match.slice(1, -1).trim()).value; return v == null ? 'NULL' : v.toString();