app/views/tramway/admin/shared/_input.html.haml in tramway-admin-1.18.1.1 vs app/views/tramway/admin/shared/_input.html.haml in tramway-admin-1.18.2
- old
+ new
@@ -9,9 +9,23 @@
= form.association property, **association_params(form_object: form_object, property: property, value: value, object: object)
- 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])
- else
- = form.input property, as: type, label: false, input_html: { name: "#{object}[#{property}]", id: "#{object}_#{property}", value: (form_object.send(property) || form_object.model.send(property) || value) }
+ = form.input property, as: type, label: false, input_html: { name: "#{object}[#{property}]", id: "#{object}_#{property}", value: (form_object.send(property) || form_object.model.send(property) || value) }
- 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
+ - if type[:input_options]
+ - options = type[:input_options]
+ = form.label form_object.model.class.human_attribute_name property
+ - case type[: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), **options
+ - when :association
+ = 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
+ - 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