diff --git a/assets/javascripts/discourse/templates/components/wizard-custom-field.hbs b/assets/javascripts/discourse/templates/components/wizard-custom-field.hbs
index 2f0b20ba..001acbe5 100644
--- a/assets/javascripts/discourse/templates/components/wizard-custom-field.hbs
+++ b/assets/javascripts/discourse/templates/components/wizard-custom-field.hbs
@@ -111,6 +111,19 @@
checked=field.char_counter}}
+
+
+
+
+
+
+
+ {{input
+ type="text"
+ class="medium"
+ value=field.placeholder}}
+
+
{{/if}}
{{#if isUpload}}
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 43b86698..a21f79bc 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -173,6 +173,7 @@ en:
max_length_placeholder: "Maximum length in characters"
char_counter: "Character Counter"
char_counter_placeholder: "Display Character Counter"
+ field_placeholder: "Field Placeholder"
file_types: "File Types"
limit: "Limit"
property: "Property"
diff --git a/controllers/custom_wizard/admin/wizard.rb b/controllers/custom_wizard/admin/wizard.rb
index 0af55d95..9b128d4d 100644
--- a/controllers/custom_wizard/admin/wizard.rb
+++ b/controllers/custom_wizard/admin/wizard.rb
@@ -109,6 +109,7 @@ class CustomWizard::AdminWizardController < CustomWizard::AdminController
:format,
:limit,
:property,
+ :placeholder,
prefill: mapped_params,
content: mapped_params,
condition: mapped_params,
diff --git a/lib/custom_wizard/builder.rb b/lib/custom_wizard/builder.rb
index a9fc6263..da10a100 100644
--- a/lib/custom_wizard/builder.rb
+++ b/lib/custom_wizard/builder.rb
@@ -86,7 +86,7 @@ class CustomWizard::Builder
required: field_template['required']
}
- %w(label description image key validations min_length max_length char_counter).each do |key|
+ %w(label description image key validations min_length max_length char_counter placeholder).each do |key|
params[key.to_sym] = field_template[key] if field_template[key]
end
diff --git a/lib/custom_wizard/field.rb b/lib/custom_wizard/field.rb
index a8160b4c..36a800c1 100644
--- a/lib/custom_wizard/field.rb
+++ b/lib/custom_wizard/field.rb
@@ -20,7 +20,8 @@ class CustomWizard::Field
:format,
:limit,
:property,
- :content
+ :content,
+ :placeholder
attr_accessor :index,
:step
@@ -44,6 +45,7 @@ class CustomWizard::Field
@limit = attrs[:limit]
@property = attrs[:property]
@content = attrs[:content]
+ @placeholder = attrs[:placeholder]
end
def label
@@ -63,18 +65,21 @@ class CustomWizard::Field
max_length: nil,
prefill: nil,
char_counter: nil,
- validations: nil
+ validations: nil,
+ placeholder: nil
},
textarea: {
min_length: nil,
max_length: nil,
prefill: nil,
- char_counter: nil
+ char_counter: nil,
+ placeholder: nil
},
composer: {
min_length: nil,
max_length: nil,
- char_counter: nil
+ char_counter: nil,
+ placeholder: nil
},
text_only: {},
date: {
diff --git a/serializers/custom_wizard/wizard_field_serializer.rb b/serializers/custom_wizard/wizard_field_serializer.rb
index 42d5eba0..fe22fdeb 100644
--- a/serializers/custom_wizard/wizard_field_serializer.rb
+++ b/serializers/custom_wizard/wizard_field_serializer.rb
@@ -71,6 +71,7 @@ class CustomWizard::FieldSerializer < ::ApplicationSerializer
end
def placeholder
+ return object.placeholder if object.placeholder.present?
I18n.t("#{object.key || i18n_key}.placeholder", default: '')
end