Added a wizard setting to toggle displaying character counter
Dieser Commit ist enthalten in:
Ursprung
ba029c7973
Commit
57b51c2972
8 geänderte Dateien mit 34 neuen und 5 gelöschten Zeilen
|
@ -98,6 +98,19 @@
|
||||||
class="small"}}
|
class="small"}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="setting">
|
||||||
|
<div class="setting-label">
|
||||||
|
<label>{{i18n 'admin.wizard.field.char_counter'}}</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="setting-value">
|
||||||
|
<span>{{i18n 'admin.wizard.field.char_counter_placeholder'}}</span>
|
||||||
|
{{input
|
||||||
|
type="checkbox"
|
||||||
|
checked=field.char_counter}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if isUpload}}
|
{{#if isUpload}}
|
||||||
|
|
|
@ -16,8 +16,10 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if textType}}
|
{{#if field.char_counter}}
|
||||||
{{char-counter field.value}}
|
{{#if textType}}
|
||||||
|
{{char-counter field.value}}
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if field.errorDescription}}
|
{{#if field.errorDescription}}
|
||||||
|
|
|
@ -166,6 +166,8 @@ en:
|
||||||
min_length_placeholder: "Minimum length in characters"
|
min_length_placeholder: "Minimum length in characters"
|
||||||
max_length: "Max Length"
|
max_length: "Max Length"
|
||||||
max_length_placeholder: "Maximum length in characters"
|
max_length_placeholder: "Maximum length in characters"
|
||||||
|
char_counter: "Character Counter"
|
||||||
|
char_counter_placeholder: "Display Character Counter"
|
||||||
file_types: "File Types"
|
file_types: "File Types"
|
||||||
limit: "Limit"
|
limit: "Limit"
|
||||||
property: "Property"
|
property: "Property"
|
||||||
|
|
|
@ -98,6 +98,7 @@ class CustomWizard::AdminWizardController < CustomWizard::AdminController
|
||||||
:type,
|
:type,
|
||||||
:min_length,
|
:min_length,
|
||||||
:max_length,
|
:max_length,
|
||||||
|
:char_counter,
|
||||||
:file_types,
|
:file_types,
|
||||||
:format,
|
:format,
|
||||||
:limit,
|
:limit,
|
||||||
|
|
|
@ -6,6 +6,7 @@ module CustomWizardFieldExtension
|
||||||
:key,
|
:key,
|
||||||
:min_length,
|
:min_length,
|
||||||
:max_length,
|
:max_length,
|
||||||
|
:char_counter,
|
||||||
:file_types,
|
:file_types,
|
||||||
:format,
|
:format,
|
||||||
:limit,
|
:limit,
|
||||||
|
@ -20,6 +21,7 @@ module CustomWizardFieldExtension
|
||||||
@key = attrs[:key]
|
@key = attrs[:key]
|
||||||
@min_length = attrs[:min_length]
|
@min_length = attrs[:min_length]
|
||||||
@max_length = attrs[:max_length]
|
@max_length = attrs[:max_length]
|
||||||
|
@char_counter = attrs[:char_counter]
|
||||||
@file_types = attrs[:file_types]
|
@file_types = attrs[:file_types]
|
||||||
@format = attrs[:format]
|
@format = attrs[:format]
|
||||||
@limit = attrs[:limit]
|
@limit = attrs[:limit]
|
||||||
|
|
|
@ -159,6 +159,7 @@ class CustomWizard::Builder
|
||||||
params[:key] = field_template['key'] if field_template['key']
|
params[:key] = field_template['key'] if field_template['key']
|
||||||
params[:min_length] = field_template['min_length'] if field_template['min_length']
|
params[:min_length] = field_template['min_length'] if field_template['min_length']
|
||||||
params[:max_length] = field_template['max_length'] if field_template['max_length']
|
params[:max_length] = field_template['max_length'] if field_template['max_length']
|
||||||
|
params[:char_counter] = field_template['char_counter'] if field_template['char_counter']
|
||||||
params[:value] = prefill_field(field_template, step_template)
|
params[:value] = prefill_field(field_template, step_template)
|
||||||
|
|
||||||
if !build_opts[:reset] && (submission = @wizard.current_submission)
|
if !build_opts[:reset] && (submission = @wizard.current_submission)
|
||||||
|
|
|
@ -4,16 +4,19 @@ class CustomWizard::Field
|
||||||
text: {
|
text: {
|
||||||
min_length: nil,
|
min_length: nil,
|
||||||
max_length: nil,
|
max_length: nil,
|
||||||
prefill: nil
|
prefill: nil,
|
||||||
|
char_counter: nil
|
||||||
},
|
},
|
||||||
textarea: {
|
textarea: {
|
||||||
min_length: nil,
|
min_length: nil,
|
||||||
max_length: nil,
|
max_length: nil,
|
||||||
prefill: nil
|
prefill: nil,
|
||||||
|
char_counter: nil
|
||||||
},
|
},
|
||||||
composer: {
|
composer: {
|
||||||
min_length: nil,
|
min_length: nil,
|
||||||
max_length: nil,
|
max_length: nil,
|
||||||
|
char_counter: nil
|
||||||
},
|
},
|
||||||
text_only: {},
|
text_only: {},
|
||||||
date: {
|
date: {
|
||||||
|
|
|
@ -7,7 +7,8 @@ class CustomWizard::FieldSerializer < ::WizardFieldSerializer
|
||||||
:format,
|
:format,
|
||||||
:limit,
|
:limit,
|
||||||
:property,
|
:property,
|
||||||
:content
|
:content,
|
||||||
|
:char_counter
|
||||||
|
|
||||||
def label
|
def label
|
||||||
return object.label if object.label.present?
|
return object.label if object.label.present?
|
||||||
|
@ -54,4 +55,8 @@ class CustomWizard::FieldSerializer < ::WizardFieldSerializer
|
||||||
def include_choices?
|
def include_choices?
|
||||||
object.choices.present?
|
object.choices.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def char_counter
|
||||||
|
object.char_counter
|
||||||
|
end
|
||||||
end
|
end
|
Laden …
In neuem Issue referenzieren