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