Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 09:20:29 +01:00
Merge pull request #103 from paviliondev/checkbox-def
DEV: checkbox value should default to false
Dieser Commit ist enthalten in:
Commit
aca0fab74e
2 geänderte Dateien mit 7 neuen und 5 gelöschten Zeilen
|
@ -31,7 +31,7 @@ class CustomWizard::Field
|
|||
@index = attrs[:index]
|
||||
@type = attrs[:type]
|
||||
@required = !!attrs[:required]
|
||||
@value = attrs[:value]
|
||||
@value = attrs[:value] || default_value
|
||||
@description = attrs[:description]
|
||||
@image = attrs[:image]
|
||||
@key = attrs[:key]
|
||||
|
@ -50,6 +50,12 @@ class CustomWizard::Field
|
|||
@label ||= PrettyText.cook(@raw[:label])
|
||||
end
|
||||
|
||||
def default_value
|
||||
if @type == 'checkbox'
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
def self.types
|
||||
@types ||= {
|
||||
text: {
|
||||
|
|
|
@ -40,10 +40,6 @@ class CustomWizard::FieldSerializer < ::ApplicationSerializer
|
|||
object.value
|
||||
end
|
||||
|
||||
def include_value?
|
||||
object.value.present?
|
||||
end
|
||||
|
||||
def i18n_key
|
||||
@i18n_key ||= "wizard.step.#{object.step.id}.fields.#{object.id}".underscore
|
||||
end
|
||||
|
|
Laden …
In neuem Issue referenzieren