|
25 | 25 | %ul
|
26 | 26 | - @member.errors.full_messages.each do |msg|
|
27 | 27 | %li= msg
|
28 |
| - - if @member.errors[:how_you_found_us].any? |
| 28 | + - if @member.errors[:how_you_found_us]&.any? |
29 | 29 | %span.text-danger= @member.errors[:how_you_found_us].first
|
30 | 30 | .col-12.mb-3
|
31 |
| - %label{ for: 'how_you_found_us' }= t('member.details.edit.how_you_found_us') |
32 |
| - %span * |
33 |
| - - options = ['From a friend', 'Search engine (Google etc.)', 'Social Media', "One of Codebar's hosts or partners"] |
34 |
| - - options.each do |option| |
35 |
| - .form-check |
36 |
| - = check_box_tag 'member[how_you_found_us][]', option, false, id: "how_you_found_us_#{option.parameterize}", class: 'form-check-input' |
37 |
| - = label_tag "how_you_found_us_#{option.parameterize}", option, class: 'form-check-label', style: 'margin-left: 8px;' |
38 |
| - = label_tag :how_you_found_us_other_reason, t('member.details.edit.how_you_found_us_other_reason'), class: 'my-1' |
39 |
| - = text_field_tag 'member[how_you_found_us_other_reason]', nil, placeholder: "Please specify how you heard about us", class: 'form-control w-100' |
| 31 | + %fieldset |
| 32 | + %legend= t('member.details.edit.how_you_found_us') |
| 33 | + %span * |
| 34 | + |
| 35 | + = f.input :how_you_found_us, |
| 36 | + as: :check_boxes, |
| 37 | + collection: Member::HOW_YOU_FOUND_US_OPTIONS, |
| 38 | + item_wrapper_class: 'form-check', |
| 39 | + label_item: true, |
| 40 | + input_html: { class: 'form-check-input' }, |
| 41 | + label_html: { class: 'form-check-label', style: 'margin-left: 8px;' } |
| 42 | + |
| 43 | + = f.input :how_you_found_us_other_reason, |
| 44 | + label: t('member.details.edit.how_you_found_us_other_reason'), |
| 45 | + placeholder: 'Please specify how you heard about us', |
| 46 | + input_html: { class: 'form-control w-100' } |
40 | 47 | = f.input :newsletter, as: :boolean, checked_value: true, unchecked_value: false
|
41 | 48 | .text-right.mb-4
|
42 | 49 | = hidden_field_tag :next_page, step2_member_path(member_type: @type)
|
|
0 commit comments