diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index d2776c45b1..2efe8461ea 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -2066,6 +2066,13 @@ pages: variable: "送信する変数" no-variable: "なし" + radioButton: "選択肢" + _radioButton: + name: "変数名" + title: "タイトル" + values: "改行で区切った選択肢" + default: "デフォルト値" + script: categories: flow: "制御" diff --git a/src/client/app/common/scripts/collect-page-vars.ts b/src/client/app/common/scripts/collect-page-vars.ts index 4c40d5d88e..a4096fb2c2 100644 --- a/src/client/app/common/scripts/collect-page-vars.ts +++ b/src/client/app/common/scripts/collect-page-vars.ts @@ -32,6 +32,12 @@ export function collectPageVars(content) { type: 'number', value: 0 }); + } else if (x.type === 'radioButton') { + pageVars.push({ + name: x.name, + type: 'string', + value: x.default || '' + }); } else if (x.children) { collect(x.children); } diff --git a/src/client/app/common/views/components/page/page.block.vue b/src/client/app/common/views/components/page/page.block.vue index 1c421fc2c0..56d1822013 100644 --- a/src/client/app/common/views/components/page/page.block.vue +++ b/src/client/app/common/views/components/page/page.block.vue @@ -16,10 +16,11 @@ import XIf from './page.if.vue'; import XTextarea from './page.textarea.vue'; import XPost from './page.post.vue'; import XCounter from './page.counter.vue'; +import XRadioButton from './page.radio-button.vue'; export default Vue.extend({ components: { - XText, XSection, XImage, XButton, XNumberInput, XTextInput, XTextareaInput, XTextarea, XPost, XSwitch, XIf, XCounter + XText, XSection, XImage, XButton, XNumberInput, XTextInput, XTextareaInput, XTextarea, XPost, XSwitch, XIf, XCounter, XRadioButton }, props: { diff --git a/src/client/app/common/views/components/page/page.radio-button.vue b/src/client/app/common/views/components/page/page.radio-button.vue new file mode 100644 index 0000000000..27c11bebad --- /dev/null +++ b/src/client/app/common/views/components/page/page.radio-button.vue @@ -0,0 +1,37 @@ + + + {{ script.interpolate(value.title) }} + {{ x }} + + + + + + diff --git a/src/client/app/common/views/pages/page-editor/els/page-editor.el.radio-button.vue b/src/client/app/common/views/pages/page-editor/els/page-editor.el.radio-button.vue new file mode 100644 index 0000000000..3401c46f47 --- /dev/null +++ b/src/client/app/common/views/pages/page-editor/els/page-editor.el.radio-button.vue @@ -0,0 +1,53 @@ + + $emit('remove')" :draggable="true"> + {{ $t('blocks.radioButton') }} + + + {{ $t('blocks._radioButton.name') }} + {{ $t('blocks._radioButton.title') }} + {{ $t('blocks._radioButton.values') }} + {{ $t('blocks._radioButton.default') }} + + + + + diff --git a/src/client/app/common/views/pages/page-editor/page-editor.blocks.vue b/src/client/app/common/views/pages/page-editor/page-editor.blocks.vue index c5f3419e7b..4d7293231f 100644 --- a/src/client/app/common/views/pages/page-editor/page-editor.blocks.vue +++ b/src/client/app/common/views/pages/page-editor/page-editor.blocks.vue @@ -19,10 +19,11 @@ import XSwitch from './els/page-editor.el.switch.vue'; import XIf from './els/page-editor.el.if.vue'; import XPost from './els/page-editor.el.post.vue'; import XCounter from './els/page-editor.el.counter.vue'; +import XRadioButton from './els/page-editor.el.radio-button.vue'; export default Vue.extend({ components: { - XDraggable, XSection, XText, XImage, XButton, XTextarea, XTextInput, XTextareaInput, XNumberInput, XSwitch, XIf, XPost, XCounter + XDraggable, XSection, XText, XImage, XButton, XTextarea, XTextInput, XTextareaInput, XNumberInput, XSwitch, XIf, XPost, XCounter, XRadioButton }, props: { diff --git a/src/client/app/common/views/pages/page-editor/page-editor.vue b/src/client/app/common/views/pages/page-editor/page-editor.vue index ade7d86991..0162915c38 100644 --- a/src/client/app/common/views/pages/page-editor/page-editor.vue +++ b/src/client/app/common/views/pages/page-editor/page-editor.vue @@ -342,6 +342,7 @@ export default Vue.extend({ label: this.$t('input-blocks'), items: [ { value: 'button', text: this.$t('blocks.button') }, + { value: 'radioButton', text: this.$t('blocks.radioButton') }, { value: 'textInput', text: this.$t('blocks.textInput') }, { value: 'textareaInput', text: this.$t('blocks.textareaInput') }, { value: 'numberInput', text: this.$t('blocks.numberInput') },