app/views/tramway/admin/shared/_input.html.haml in tramway-admin-1.18.2 vs app/views/tramway/admin/shared/_input.html.haml in tramway-admin-1.18.3
- old
+ new
@@ -1,8 +1,9 @@
- value = value_from_params(model_class: model_class, property: property, type: type)
- form_object = instance_variable_get "@#{object}_form"
-- if type.is_a? Symbol
+- if type.class.in? [ Symbol, String ]
+ - type = type.to_sym
= form.label form_object.model.class.human_attribute_name property
- case type
- when :default
= form.input property, label: false, input_html: { name: "#{object}[#{property}]", id: "#{object}_#{property}", value: (form_object.send(property) || form_object.model.send(property) || value) }, selected: (form_object.model.send(property) || value)
- when :association
@@ -23,9 +24,9 @@
= form.association property, **association_params(form_object: form_object, property: property, value: value, object: object), **options
- when :polymorphic_association
= form.input property, **polymorphic_association_params(object: object, form_object: form_object, property: property, value: value[:id])
= form.input "#{property}_type", input_html: { name: "#{object}[#{property}_type]", id: "#{object}_#{property}_type", value: (form_object.send(property) || form_object.model.send("#{property}_type") || value[:type]) }, selected: (form_object.model.send("#{property}_type") || value[:type]), **options
- else
- = form.input property, as: type[:type], label: false, input_html: { name: "#{object}[#{property}]", id: "#{object}_#{property}", value: (form_object.send(property) || form_object.model.send(property) || value) }, **options
+ = form.input property, as: type[:type].to_sym, label: false, input_html: { name: "#{object}[#{property}]", id: "#{object}_#{property}", value: (form_object.send(property) || form_object.model.send(property) || value) }, **options
- else
- property_value = form_object.model.values.present? && form_object.model.values[property.to_s]
= render 'tramway/core/shared/input_extended', field: type[:extended_form_property], class_name: :record, value: property_value, f: form