diff --git a/app/helpers/spree/admin/base_helper.rb b/app/helpers/spree/admin/base_helper.rb index 6fb6dc4ba6..7615f2b6c9 100644 --- a/app/helpers/spree/admin/base_helper.rb +++ b/app/helpers/spree/admin/base_helper.rb @@ -62,6 +62,10 @@ module Spree end end + # Here we show a text field for all string fields except when the field name ends in + # "_from_list", in that case we render a dropdown. + # In this specific case, to render the dropdown, the object provided must have a method named + # like "#{field}_values" that returns an array with the string options to be listed. def preference_field_for_text_field(form, field, options, object) if field.end_with?('_from_list') && object.respond_to?("#{field}_values") list_values = object.__send__("#{field}_values") @@ -102,13 +106,17 @@ module Spree ) end + # maps each preference to a hash containing the label and field html. + # E.g. { :label => "