Sha256: 4ab02ebde24db532ed03e1536891aa760e3a24b58279ba5f698c1fd341443549

Contents?: true

Size: 1.54 KB

Versions: 38

Compression:

Stored size: 1.54 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 = field.options.is_a?(Hash) ? field.options : (JSON.parse(field.options) unless field.options == '')
  - if parsed_json && parsed_json.dig('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

38 entries across 38 versions & 1 rubygems

Version Path
tramway-core-1.11.2.1 app/views/tramway/core/shared/_input_extended.html.haml
tramway-core-1.11.2 app/views/tramway/core/shared/_input_extended.html.haml
tramway-core-1.11.1 app/views/tramway/core/shared/_input_extended.html.haml
tramway-core-1.11 app/views/tramway/core/shared/_input_extended.html.haml
tramway-core-1.10.3.1 app/views/tramway/core/shared/_input_extended.html.haml
tramway-core-1.10.3 app/views/tramway/core/shared/_input_extended.html.haml
tramway-core-1.10.2.3 app/views/tramway/core/shared/_input_extended.html.haml
tramway-core-1.10.2.2 app/views/tramway/core/shared/_input_extended.html.haml
tramway-core-1.10.2.1 app/views/tramway/core/shared/_input_extended.html.haml
tramway-core-1.10.2 app/views/tramway/core/shared/_input_extended.html.haml
tramway-core-1.10.1 app/views/tramway/core/shared/_input_extended.html.haml
tramway-core-1.10 app/views/tramway/core/shared/_input_extended.html.haml
tramway-core-1.9.9.3 app/views/tramway/core/shared/_input_extended.html.haml
tramway-core-1.9.9.2 app/views/tramway/core/shared/_input_extended.html.haml
tramway-core-1.9.9.1 app/views/tramway/core/shared/_input_extended.html.haml
tramway-core-1.9.9 app/views/tramway/core/shared/_input_extended.html.haml
tramway-core-1.9.8.1 app/views/tramway/core/shared/_input_extended.html.haml
tramway-core-1.9.8 app/views/tramway/core/shared/_input_extended.html.haml
tramway-core-1.9.7 app/views/tramway/core/shared/_input_extended.html.haml
tramway-core-1.9.6.1 app/views/tramway/core/shared/_input_extended.html.haml