Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 09:20:29 +01:00
FEATURE: placeholder setting for text type fields
Dieser Commit ist enthalten in:
Ursprung
c2e51cba3a
Commit
21ac87cdda
6 geänderte Dateien mit 26 neuen und 5 gelöschten Zeilen
|
@ -111,6 +111,19 @@
|
||||||
checked=field.char_counter}}
|
checked=field.char_counter}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="setting full">
|
||||||
|
<div class="setting-label">
|
||||||
|
<label>{{i18n "admin.wizard.field.field_placeholder"}}</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="setting-value">
|
||||||
|
{{input
|
||||||
|
type="text"
|
||||||
|
class="medium"
|
||||||
|
value=field.placeholder}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if isUpload}}
|
{{#if isUpload}}
|
||||||
|
|
|
@ -173,6 +173,7 @@ en:
|
||||||
max_length_placeholder: "Maximum length in characters"
|
max_length_placeholder: "Maximum length in characters"
|
||||||
char_counter: "Character Counter"
|
char_counter: "Character Counter"
|
||||||
char_counter_placeholder: "Display Character Counter"
|
char_counter_placeholder: "Display Character Counter"
|
||||||
|
field_placeholder: "Field Placeholder"
|
||||||
file_types: "File Types"
|
file_types: "File Types"
|
||||||
limit: "Limit"
|
limit: "Limit"
|
||||||
property: "Property"
|
property: "Property"
|
||||||
|
|
|
@ -109,6 +109,7 @@ class CustomWizard::AdminWizardController < CustomWizard::AdminController
|
||||||
:format,
|
:format,
|
||||||
:limit,
|
:limit,
|
||||||
:property,
|
:property,
|
||||||
|
:placeholder,
|
||||||
prefill: mapped_params,
|
prefill: mapped_params,
|
||||||
content: mapped_params,
|
content: mapped_params,
|
||||||
condition: mapped_params,
|
condition: mapped_params,
|
||||||
|
|
|
@ -86,7 +86,7 @@ class CustomWizard::Builder
|
||||||
required: field_template['required']
|
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]
|
params[key.to_sym] = field_template[key] if field_template[key]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,8 @@ class CustomWizard::Field
|
||||||
:format,
|
:format,
|
||||||
:limit,
|
:limit,
|
||||||
:property,
|
:property,
|
||||||
:content
|
:content,
|
||||||
|
:placeholder
|
||||||
|
|
||||||
attr_accessor :index,
|
attr_accessor :index,
|
||||||
:step
|
:step
|
||||||
|
@ -44,6 +45,7 @@ class CustomWizard::Field
|
||||||
@limit = attrs[:limit]
|
@limit = attrs[:limit]
|
||||||
@property = attrs[:property]
|
@property = attrs[:property]
|
||||||
@content = attrs[:content]
|
@content = attrs[:content]
|
||||||
|
@placeholder = attrs[:placeholder]
|
||||||
end
|
end
|
||||||
|
|
||||||
def label
|
def label
|
||||||
|
@ -63,18 +65,21 @@ class CustomWizard::Field
|
||||||
max_length: nil,
|
max_length: nil,
|
||||||
prefill: nil,
|
prefill: nil,
|
||||||
char_counter: nil,
|
char_counter: nil,
|
||||||
validations: nil
|
validations: nil,
|
||||||
|
placeholder: nil
|
||||||
},
|
},
|
||||||
textarea: {
|
textarea: {
|
||||||
min_length: nil,
|
min_length: nil,
|
||||||
max_length: nil,
|
max_length: nil,
|
||||||
prefill: nil,
|
prefill: nil,
|
||||||
char_counter: nil
|
char_counter: nil,
|
||||||
|
placeholder: nil
|
||||||
},
|
},
|
||||||
composer: {
|
composer: {
|
||||||
min_length: nil,
|
min_length: nil,
|
||||||
max_length: nil,
|
max_length: nil,
|
||||||
char_counter: nil
|
char_counter: nil,
|
||||||
|
placeholder: nil
|
||||||
},
|
},
|
||||||
text_only: {},
|
text_only: {},
|
||||||
date: {
|
date: {
|
||||||
|
|
|
@ -71,6 +71,7 @@ class CustomWizard::FieldSerializer < ::ApplicationSerializer
|
||||||
end
|
end
|
||||||
|
|
||||||
def placeholder
|
def placeholder
|
||||||
|
return object.placeholder if object.placeholder.present?
|
||||||
I18n.t("#{object.key || i18n_key}.placeholder", default: '')
|
I18n.t("#{object.key || i18n_key}.placeholder", default: '')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Laden …
In neuem Issue referenzieren