Sha256: ffcec8912566b7a3c0dfe44373d7d05330d099586c9c4c09bc09bca9a4d3a905

Contents?: true

Size: 1.5 KB

Versions: 5

Compression:

Stored size: 1.5 KB

Contents

- value = defined?(value).present? ? value : ''
- case field.field_type
- when 'text', 'string', 'numeric', 'date_picker'
  - if value.present?
    = f.input field.title.to_sym, as: field.field_type, input_html: { class: class_name, id: "#{class_name}_#{field.title}", name: "#{class_name}[#{field.title}]", value: value }
  - else
    = f.input field.title.to_sym, as: field.field_type, input_html: { class: class_name, id: "#{class_name}_#{field.title}", name: "#{class_name}[#{field.title}]" }
- when 'select'
  - parsed_json = JSON.parse(field.options) unless field.options == ''
  - if parsed_json && parsed_json['collection']['name']
    - if value.present?
      = f.input field.title.to_sym, as: :select, collection: collection_list_by(name: parsed_json['collection']['name']), input_html: { class: class_name, id: "#{class_name}_#{field.title}", name: "#{class_name}[#{field.title}]" }, selected: value
    - else
      = f.input field.title.to_sym, as: :select, collection: collection_list_by(name: parsed_json['collection']['name']), input_html: { class: class_name, id: "#{class_name}_#{field.title}", name: "#{class_name}[#{field.title}]" }
  - else
    - if value.present?
      = f.input field.title.to_sym, as: :select, input_html: { class: class_name, id: "#{class_name}_#{field.title}", name: "#{class_name}[#{field.title}]" }, selected: value
    - else
      = f.input field.title.to_sym, as: :select, input_html: { class: class_name, id: "#{class_name}_#{field.title}", name: "#{class_name}[#{field.title}]" }

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tramway-core-1.6.4 app/views/tramway/core/shared/_input_extended.html.haml
tramway-core-1.6.3 app/views/tramway/core/shared/_input_extended.html.haml
tramway-core-1.6.2 app/views/tramway/core/shared/_input_extended.html.haml
tramway-core-1.6.1 app/views/tramway/core/shared/_input_extended.html.haml
tramway-core-1.6 app/views/tramway/core/shared/_input_extended.html.haml