Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-25 02:30:28 +01:00
Also standardise booleans when pre-filling fields
Dieser Commit ist enthalten in:
Ursprung
72810b755a
Commit
dcee0b3774
1 geänderte Dateien mit 10 neuen und 2 gelöschten Zeilen
|
@ -144,7 +144,11 @@ class CustomWizard::Builder
|
|||
end
|
||||
end
|
||||
|
||||
field = step.add_field(params)
|
||||
if field_template['type'] === 'checkbox'
|
||||
params[:value] = standardise_boolean(params[:value])
|
||||
end
|
||||
|
||||
step.add_field(params)
|
||||
|
||||
if field_template['type'] === 'dropdown'
|
||||
build_dropdown_list(field, field_template)
|
||||
|
@ -216,10 +220,14 @@ class CustomWizard::Builder
|
|||
|
||||
## ensure all checkboxes are booleans
|
||||
if field['type'] === 'checkbox'
|
||||
updater.fields[field['id']] = value == 'true'
|
||||
updater.fields[field['id']] = standardise_boolean(value)
|
||||
end
|
||||
end
|
||||
|
||||
def standardise_boolean(value)
|
||||
!!HasCustomFields::Helpers::CUSTOM_FIELD_TRUE.include?(value)
|
||||
end
|
||||
|
||||
def create_topic(user, action, data)
|
||||
if action['custom_title']
|
||||
title = action['custom_title']
|
||||
|
|
Laden …
In neuem Issue referenzieren