Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-09 20:02:54 +01:00
bugfix min length
Dieser Commit ist enthalten in:
Ursprung
7d04ffbde5
Commit
620f30368e
1 geänderte Dateien mit 9 neuen und 1 gelöschten Zeilen
|
@ -227,7 +227,11 @@ class CustomWizard::Builder
|
|||
|
||||
def validate_field(field, updater, step_template)
|
||||
value = updater.fields[field['id']]
|
||||
min_length = field['min_length']
|
||||
min_length = false
|
||||
|
||||
if is_text_type(field)
|
||||
min_length = field['min_length']
|
||||
end
|
||||
|
||||
if min_length && value.is_a?(String) && value.strip.length < min_length.to_i
|
||||
label = field['label'] || I18n.t("#{field['key']}.label")
|
||||
|
@ -246,6 +250,10 @@ class CustomWizard::Builder
|
|||
end
|
||||
end
|
||||
|
||||
def is_text_type(field)
|
||||
['text', 'textarea'].include? field['type']
|
||||
end
|
||||
|
||||
def standardise_boolean(value)
|
||||
!!HasCustomFields::Helpers::CUSTOM_FIELD_TRUE.include?(value)
|
||||
end
|
||||
|
|
Laden …
In neuem Issue referenzieren