0
0
Fork 1
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:
Angus McLeod 2019-06-11 17:19:46 +10:00
Ursprung 7d04ffbde5
Commit 620f30368e

Datei anzeigen

@ -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