1
0
Fork 0

Merge pull request #103 from paviliondev/checkbox-def

DEV: checkbox value should default to false
Dieser Commit ist enthalten in:
Angus McLeod 2021-05-03 17:55:33 +12:00 committet von GitHub
Commit aca0fab74e
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 7 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -31,7 +31,7 @@ class CustomWizard::Field
@index = attrs[:index] @index = attrs[:index]
@type = attrs[:type] @type = attrs[:type]
@required = !!attrs[:required] @required = !!attrs[:required]
@value = attrs[:value] @value = attrs[:value] || default_value
@description = attrs[:description] @description = attrs[:description]
@image = attrs[:image] @image = attrs[:image]
@key = attrs[:key] @key = attrs[:key]
@ -50,6 +50,12 @@ class CustomWizard::Field
@label ||= PrettyText.cook(@raw[:label]) @label ||= PrettyText.cook(@raw[:label])
end end
def default_value
if @type == 'checkbox'
false
end
end
def self.types def self.types
@types ||= { @types ||= {
text: { text: {

Datei anzeigen

@ -40,10 +40,6 @@ class CustomWizard::FieldSerializer < ::ApplicationSerializer
object.value object.value
end end
def include_value?
object.value.present?
end
def i18n_key def i18n_key
@i18n_key ||= "wizard.step.#{object.step.id}.fields.#{object.id}".underscore @i18n_key ||= "wizard.step.#{object.step.id}.fields.#{object.id}".underscore
end end