|
6 | 6 | </div> |
7 | 7 |
|
8 | 8 | <div class="form-check"> |
9 | | - <%= radio_button_tag(:account, :bank, false, class: 'form-check-input account_type') %> |
| 9 | + <%= radio_button_tag(:account, :bank, @bank_selected, class: 'form-check-input account_type') %> |
10 | 10 | <%= label_tag(:account, "I am an Essentials Bank. I do NOT distribute diapers/period supplies directly to the public, I distribute them to partner agencies who distribute them to the public.", class: 'form-check-label') %> |
11 | 11 | </div> |
12 | 12 | <div class="form-check"> |
13 | 13 | <%= radio_button_tag(:account, :partner, false, class: 'form-check-input account_type') %> |
14 | 14 | <%= label_tag(:account, "I am a Partner Agency to an Essentials Bank. I distribute the diapers/period supplies that I receive from essentials banks directly to the public.", class: 'form-check-label') %> |
15 | 15 | </div> |
16 | 16 |
|
17 | | - <% if @bank_selected %> |
18 | | - <script type="module"> |
19 | | - $(document).ready(function() { |
20 | | - const bankRadioButtons = $('.account_type[value="bank"]:not(:checked)'); |
21 | | - |
22 | | - if (bankRadioButtons.length > 0) { |
23 | | - bankRadioButtons.eq(0).click(); |
24 | | - } |
25 | | - }); |
26 | | - </script> |
27 | | - <% else %> |
28 | | - <script type="module"> |
29 | | - $(document).ready(function() { |
30 | | - $('#create_bank').hide() |
31 | | - $('#partner_info').hide() |
32 | | - }); |
33 | | - </script> |
34 | | - <% end %> |
35 | | - |
36 | | - <script type="module"> |
37 | | - $('.account_type').change(function() { |
38 | | - if (this.value === 'bank') { |
39 | | - $('#create_bank').show() |
40 | | - $('#partner_info').hide() |
41 | | - } else { |
42 | | - $('#create_bank').hide() |
43 | | - $('#partner_info').show() |
44 | | - } |
45 | | - }) |
46 | | - </script> |
| 17 | + <%# Hide #partner_info and #create_bank selections unless radio button selected %> |
| 18 | + <style> |
| 19 | + #partner_info, #create_bank { |
| 20 | + display: none; |
| 21 | + } |
| 22 | + .form-check:has(#account_partner:checked)~#partner_info, |
| 23 | + .form-check:has(#account_bank:checked)~#create_bank { |
| 24 | + display: block; |
| 25 | + } |
| 26 | + </style> |
47 | 27 |
|
48 | 28 | <div class='card-text' id='partner_info'> |
49 | 29 | <p class='p-2'>Are you a current partner to diaper and/or period supply banks? If so please go <a href='https://humanessentials.app/users/sign_in'>here</a> to login.</p> |
|
0 commit comments