Sha256: 44dba6073a63072f10b8c6dbde61daa0943fa305e3b201cdbe7280b463cce45d

Contents?: true

Size: 1.37 KB

Versions: 5

Compression:

Stored size: 1.37 KB

Contents

<% current = f.object.find_or_create_a_field_by( field_setting.id, 'radio' ) %>
<%= f.simple_fields_for "radios_attributes[]", current do |ff| %>
	<% if ff.object.choices.any? %>
		<%= ff.input :choice_ids, 
					label: field_setting.name.capitalize, 
					hint: prepare_description_for_selections_form_hint(field_setting), 
					as: :radio_buttons, 
					collection: field_setting.choices.order(:label), 
					label_method: -> (x){ "<span class=\"standard-form--input-box\"></span>#{x[:label]}".html_safe },
					value_method: :id, 
					checked: ff.object.choices.first.id, 
					include_blank: field_setting.allow_null %>
	<% else %>
		<%= ff.input :choice_ids,
					label: field_setting.name.capitalize,
					hint: prepare_description_for_selections_form_hint(field_setting),
					as: :radio_buttons,
					collection: field_setting.choices.order(:label),
					label_method: -> (x){ "<span class=\"standard-form--input-box\"></span>#{x[:label]}".html_safe },
					value_method: :id,
					checked: ( field_setting.default_choice.id unless field_setting.default_choice_id.nil? ),
					include_blank: field_setting.allow_null %>
	<% end %>
	<%= ff.input :field_setting_id, as: :hidden, input_html: { value: field_setting.id } %>
	<%= ff.input :id, as: :hidden, input_html: { value: ff.object.id } %>
	<%= ff.input :fieldable_id, as: :hidden %>
	<%= ff.input :fieldable_type, as: :hidden %>
<% end %>

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
binda-0.1.8 app/views/binda/fieldable/form_item_selections/_form_item_radio.html.erb
binda-0.1.7 app/views/binda/fieldable/form_item_selections/_form_item_radio.html.erb
binda-0.1.6 app/views/binda/fieldable/form_item_selections/_form_item_radio.html.erb
binda-0.1.5 app/views/binda/fieldable/form_item_selections/_form_item_radio.html.erb
binda-0.1.4 app/views/binda/fieldable/form_item_selections/_form_item_radio.html.erb