diff --git a/app/assets/javascripts/admin/addon/lib/template-form-fields.js b/app/assets/javascripts/admin/addon/lib/template-form-fields.js index 80bf3c42050..f152a751d6a 100644 --- a/app/assets/javascripts/admin/addon/lib/template-form-fields.js +++ b/app/assets/javascripts/admin/addon/lib/template-form-fields.js @@ -4,6 +4,7 @@ export const templateFormFields = [ { type: "checkbox", structure: `- type: checkbox + id: ${I18n.t("admin.form_templates.field_placeholders.id")} attributes: label: "${I18n.t("admin.form_templates.field_placeholders.label")}" validations: @@ -12,6 +13,7 @@ export const templateFormFields = [ { type: "input", structure: `- type: input + id: ${I18n.t("admin.form_templates.field_placeholders.id")} attributes: label: "${I18n.t("admin.form_templates.field_placeholders.label")}" placeholder: "${I18n.t( @@ -23,6 +25,7 @@ export const templateFormFields = [ { type: "textarea", structure: `- type: textarea + id: ${I18n.t("admin.form_templates.field_placeholders.id")} attributes: label: "${I18n.t("admin.form_templates.field_placeholders.label")}" placeholder: "${I18n.t( @@ -34,6 +37,7 @@ export const templateFormFields = [ { type: "dropdown", structure: `- type: dropdown + id: ${I18n.t("admin.form_templates.field_placeholders.id")} choices: - "${I18n.t("admin.form_templates.field_placeholders.choices.first")}" - "${I18n.t("admin.form_templates.field_placeholders.choices.second")}" @@ -50,6 +54,7 @@ export const templateFormFields = [ { type: "upload", structure: `- type: upload + id: ${I18n.t("admin.form_templates.field_placeholders.id")} attributes: file_types: ".jpg, .png, .gif" allow_multiple: false @@ -60,6 +65,7 @@ export const templateFormFields = [ { type: "multiselect", structure: `- type: multi-select + id: ${I18n.t("admin.form_templates.field_placeholders.id")} choices: - "${I18n.t("admin.form_templates.field_placeholders.choices.first")}" - "${I18n.t("admin.form_templates.field_placeholders.choices.second")}" diff --git a/app/assets/javascripts/discourse/app/components/composer-container.hbs b/app/assets/javascripts/discourse/app/components/composer-container.hbs index 0b4e430133c..62ed4270389 100644 --- a/app/assets/javascripts/discourse/app/components/composer-container.hbs +++ b/app/assets/javascripts/discourse/app/components/composer-container.hbs @@ -125,6 +125,7 @@ @focusTarget={{this.composer.focusTarget}} @disableTextarea={{this.composer.disableTextarea}} @formTemplateIds={{this.composer.formTemplateIds}} + @formTemplateInitialValues={{this.composer.formTemplateInitialValues}} >
{{/if}}
- + {{else}}
\ No newline at end of file diff --git a/app/assets/javascripts/discourse/app/components/form-template-field/input.hbs b/app/assets/javascripts/discourse/app/components/form-template-field/input.hbs index eb52d970ed4..e163b43b140 100644 --- a/app/assets/javascripts/discourse/app/components/form-template-field/input.hbs +++ b/app/assets/javascripts/discourse/app/components/form-template-field/input.hbs @@ -9,8 +9,9 @@ {{/if}} instead }} {{! Current using {{@attributes.none_label}} {{/if}} {{#each @choices as |choice|}} - + {{/each}}
\ No newline at end of file diff --git a/app/assets/javascripts/discourse/app/components/form-template-field/multi-select.js b/app/assets/javascripts/discourse/app/components/form-template-field/multi-select.js new file mode 100644 index 00000000000..be6f59a9f91 --- /dev/null +++ b/app/assets/javascripts/discourse/app/components/form-template-field/multi-select.js @@ -0,0 +1,9 @@ +import Component from "@glimmer/component"; +import { action } from "@ember/object"; + +export default class FormTemplateFieldMultiSelect extends Component { + @action + isSelected(option) { + return this.args.value?.includes(option); + } +} diff --git a/app/assets/javascripts/discourse/app/components/form-template-field/textarea.hbs b/app/assets/javascripts/discourse/app/components/form-template-field/textarea.hbs index 19328063bbc..0232fa6e660 100644 --- a/app/assets/javascripts/discourse/app/components/form-template-field/textarea.hbs +++ b/app/assets/javascripts/discourse/app/components/form-template-field/textarea.hbs @@ -8,7 +8,8 @@ {{/if}}