0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-22 09:20:29 +01:00

Added a wizard setting to toggle displaying character counter

Dieser Commit ist enthalten in:
Faizaan Gagan 2021-01-12 16:16:24 +05:30
Ursprung ba029c7973
Commit 57b51c2972
8 geänderte Dateien mit 34 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -98,6 +98,19 @@
class="small"}}
</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 isUpload}}

Datei anzeigen

@ -16,9 +16,11 @@
</div>
{{/if}}
{{#if field.char_counter}}
{{#if textType}}
{{char-counter field.value}}
{{/if}}
{{/if}}
{{#if field.errorDescription}}
<div class='field-error-description'>{{{field.errorDescription}}}</div>

Datei anzeigen

@ -166,6 +166,8 @@ en:
min_length_placeholder: "Minimum length in characters"
max_length: "Max Length"
max_length_placeholder: "Maximum length in characters"
char_counter: "Character Counter"
char_counter_placeholder: "Display Character Counter"
file_types: "File Types"
limit: "Limit"
property: "Property"

Datei anzeigen

@ -98,6 +98,7 @@ class CustomWizard::AdminWizardController < CustomWizard::AdminController
:type,
:min_length,
:max_length,
:char_counter,
:file_types,
:format,
:limit,

Datei anzeigen

@ -6,6 +6,7 @@ module CustomWizardFieldExtension
:key,
:min_length,
:max_length,
:char_counter,
:file_types,
:format,
:limit,
@ -20,6 +21,7 @@ module CustomWizardFieldExtension
@key = attrs[:key]
@min_length = attrs[:min_length]
@max_length = attrs[:max_length]
@char_counter = attrs[:char_counter]
@file_types = attrs[:file_types]
@format = attrs[:format]
@limit = attrs[:limit]

Datei anzeigen

@ -159,6 +159,7 @@ class CustomWizard::Builder
params[:key] = field_template['key'] if field_template['key']
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[:char_counter] = field_template['char_counter'] if field_template['char_counter']
params[:value] = prefill_field(field_template, step_template)
if !build_opts[:reset] && (submission = @wizard.current_submission)

Datei anzeigen

@ -4,16 +4,19 @@ class CustomWizard::Field
text: {
min_length: nil,
max_length: nil,
prefill: nil
prefill: nil,
char_counter: nil
},
textarea: {
min_length: nil,
max_length: nil,
prefill: nil
prefill: nil,
char_counter: nil
},
composer: {
min_length: nil,
max_length: nil,
char_counter: nil
},
text_only: {},
date: {

Datei anzeigen

@ -7,7 +7,8 @@ class CustomWizard::FieldSerializer < ::WizardFieldSerializer
:format,
:limit,
:property,
:content
:content,
:char_counter
def label
return object.label if object.label.present?
@ -54,4 +55,8 @@ class CustomWizard::FieldSerializer < ::WizardFieldSerializer
def include_choices?
object.choices.present?
end
def char_counter
object.char_counter
end
end