Sha256: 90603a433f6c8db78ce61097d50b59340f2dcdd44495ecb1b7ecf0defe127f5f

Contents?: true

Size: 1.44 KB

Versions: 4

Compression:

Stored size: 1.44 KB

Contents

- value = params.dig(model_class.to_s.underscore, property.to_s)
- 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
    - full_class_name_association = form_object.class.full_class_name_association(property)
    = form.association property, label: false, input_html: { name: "#{object}[#{property}]", id: "#{object}_#{property}", value: (form_object.send(property) || form_object.model.send("#{property}_id") || value) }, selected: (form_object.model.send("#{property}_id") || value), collection: full_class_name_association.active.map { |obj| decorator_class(full_class_name_association).decorate obj }
  - 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

4 entries across 4 versions & 1 rubygems

Version Path
tramway-admin-1.6.3 app/views/tramway/admin/shared/_input.html.haml
tramway-admin-1.6.2 app/views/tramway/admin/shared/_input.html.haml
tramway-admin-1.6.1 app/views/tramway/admin/shared/_input.html.haml
tramway-admin-1.6 app/views/tramway/admin/shared/_input.html.haml