houdini/app/views/supporters/_manual_address_fields.html.erb

45 lines
2.3 KiB
Text

<section class='group pastelBox--grey u-padding--5'>
<!--= def 'selected_usa' true -->
<label style='display: none' class='u-centered u-marginBottom--5'>Shipping address (required)</label>
<!--= show_if donate_wiz.to_ship -->
<%= render 'nonprofits/supporters/fieldset', cssClass: 'col-8 u-fontSize--14', profile: profile, name: 'address', placeholder: 'Address' %>
<%= render 'nonprofits/supporters/fieldset', cssClass: 'col-right-4 u-fontSize--14', profile: profile, name: 'city', placeholder: 'City' %>
<fieldset class='u-marginBottom--0 u-floatL col-4'>
<select name='state_code' class='select u-fontSize--14 u-marginBottom--0'>
<!--= show_if selected_usa -->
<!--= remove_attr_if (not selected_usa) 'name' -->
<% supporter_state = profile ? profile['state_code'] : @nonprofit.state_code %>
<option value='' disabled>Select State</option>
<% Format::Geography::StateMappings.each do |name, code| %>
<option <%= supporter_state == code ? 'selected="selected"' : ''%> value='<%=code%>'><%= name.titleize %></option>
<% end %>
</select>
<% supporter_region = profile ? profile['state_code'] : '' %>
<input class='u-marginBottom--0' type='text' title="Region" name='state_code' placeholder='Region' value="<%= supporter_region %>">
<!--= hide_if selected_usa -->
<!--= remove_attr_if selected_usa 'name' -->
</fieldset>
<fieldset class='u-marginBottom--0 u-floatL col-right-4 u-fontSize--14'>
<input class='u-marginBottom--0' type='text' title="Region" name='zip_code' placeholder='' value="<%= profile && profile['zip_code']%>">
<!--= if selected_usa (set_attr 'placeholder' 'Zip Code') (set_attr 'placeholder' 'Postal Code') -->
</fieldset>
<fieldset class='u-marginBottom--0 u-floatL col-right-4'>
<select class='select u-fontSize--14 u-marginBottom--0' name='country'>
<!--= def 'selected_usa' (is_usa get_value) -->
<!--= on 'change' (def 'selected_usa' (is_usa get_value)) -->
<% supporter_country = profile ? profile['country'] : 'United States' %>
<option selected="selected" value='<%=supporter_country%>'><%= supporter_country %></option>
<% Format::Geography::Countries.each do |c| %>
<option value='<%=c%>'><%= c %></option>
<% end %>
</select>
</fieldset>
</section>