Merge pull request #131 from paviliondev/text-placeholder
FEATURE: placeholder setting for text type fields
Dieser Commit ist enthalten in:
Commit
9293aaeabc
8 geänderte Dateien mit 47 neuen und 5 gelöschten Zeilen
|
@ -111,6 +111,19 @@
|
|||
checked=field.char_counter}}
|
||||
</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 isUpload}}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{{d-editor
|
||||
tabindex=field.tabindex
|
||||
value=composer.reply
|
||||
placeholder=replyPlaceholder
|
||||
placeholderTranslated=replyPlaceholder
|
||||
previewUpdated=(action "previewUpdated")
|
||||
markdownOptions=markdownOptions
|
||||
extraButtons=(action "extraButtons")
|
||||
|
|
|
@ -162,4 +162,15 @@
|
|||
.text-field input {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.text-field,
|
||||
.textarea-field,
|
||||
.composer-field {
|
||||
input[type="text"],
|
||||
textarea {
|
||||
&:focus::placeholder {
|
||||
color: transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -109,6 +109,7 @@ class CustomWizard::AdminWizardController < CustomWizard::AdminController
|
|||
:format,
|
||||
:limit,
|
||||
:property,
|
||||
:placeholder,
|
||||
prefill: mapped_params,
|
||||
content: mapped_params,
|
||||
condition: mapped_params,
|
||||
|
|
|
@ -187,6 +187,16 @@ class CustomWizard::Builder
|
|||
)
|
||||
end
|
||||
|
||||
if field_template['placeholder'].present?
|
||||
params[:placeholder] = mapper.interpolate(
|
||||
field_template['placeholder'],
|
||||
user: true,
|
||||
value: true,
|
||||
wizard: true,
|
||||
template: true
|
||||
)
|
||||
end
|
||||
|
||||
field = step.add_field(params)
|
||||
end
|
||||
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Laden …
In neuem Issue referenzieren