Sha256: 1d2a7f1a42f4c41c15181e3d76f4ce1479fce77e8d5e79120ab83f8cce8a5563

Contents?: true

Size: 1.57 KB

Versions: 6

Compression:

Stored size: 1.57 KB

Contents

- value = value_from_params(model_class: model_class, property: property, type: type)
- form_object = instance_variable_get "@#{object}_form"
- if type.is_a? Symbol
  = 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
    = 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) } 
- 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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tramway-admin-1.18.1.1 app/views/tramway/admin/shared/_input.html.haml
tramway-admin-1.18.1 app/views/tramway/admin/shared/_input.html.haml
tramway-admin-1.18.0.1 app/views/tramway/admin/shared/_input.html.haml
tramway-admin-1.18 app/views/tramway/admin/shared/_input.html.haml
tramway-admin-1.17.0.1 app/views/tramway/admin/shared/_input.html.haml
tramway-admin-1.17 app/views/tramway/admin/shared/_input.html.haml