app/views/spree/zoned/_billing.html.erb in spree_zoned-0.5.31 vs app/views/spree/zoned/_billing.html.erb in spree_zoned-0.5.32

- old
+ new

@@ -15,90 +15,102 @@ $agb.dialog('open'); return false; // prevent the default action, e.g. following a link }); }); </script> -<div class="inner" data-hook="billing_inner"> - <fieldset id="billing" data-hook> - <%= form.fields_for :bill_address do |bill_form| %> - <legend><%= t(:billing_address) %></legend> - <p class="field" id="bfirstname"> - <%= bill_form.label :firstname, t(:first_name) %><span class="req">*</span><br /> - <%= bill_form.text_field :firstname, :class => 'required' %> - </p> - <p class="field" id="blastname"> - <%= bill_form.label :lastname, t(:last_name) %><span class="req">*</span><br /> - <%= bill_form.text_field :lastname, :class => 'required' %> - </p> - <% if Spree::Config[:company] %> - <p class="field" id="bcompany"> - <%= bill_form.label :company, t(:company) %><br /> - <%= bill_form.text_field :company %> - </p> - <% end %> - <p class="field" id="baddress1"> - <%= bill_form.label :address1, t(:street_address) %><span class="req">*</span><br /> - <%= bill_form.text_field :address1, :class => 'required' %> - </p> - <p class="field" id="baddress2"> - <%= bill_form.label :address2, t(:street_address_2) %><br /> - <%= bill_form.text_field :address2 %> - </p> +<p class="field" id="bfirstname"> + <%= bill_form.label :firstname, t(:first_name) %><span class="req">*</span><br /> + <%= bill_form.text_field :firstname, :class => 'required' %> +</p> +<p class="field" id="blastname"> + <%= bill_form.label :lastname, t(:last_name) %><span class="req">*</span><br /> + <%= bill_form.text_field :lastname, :class => 'required' %> +</p> +<% if Spree::Config[:company] %> + <p class="field" id="bcompany"> + <%= bill_form.label :company, t(:company) %><br /> + <%= bill_form.text_field :company %> + </p> +<% end %> +<p class="field" id="baddress1"> + <%= bill_form.label :address1, t(:street_address) %><span class="req">*</span><br /> + <%= bill_form.text_field :address1, :class => 'required' %> +</p> +<p class="field" id="baddress2"> + <%= bill_form.label :address2, t(:street_address_2) %><br /> + <%= bill_form.text_field :address2 %> +</p> - <p class="field" id="bcity"> - <%= bill_form.label :city, t(:city) %><span class="req">*</span><br /> - <%= bill_form.text_field :city, :class => 'required' %> - </p> +<p class="field" id="bcity"> + <%= bill_form.label :city, t(:city) %><span class="req">*</span><br /> + <%= bill_form.text_field :city, :class => 'required' %> +</p> - <p class="field" id="bcountry"> - <%= bill_form.label :country_id, t(:country) %><span class="req">*</span><br /> - <span id="bcountry"> - <%= bill_form.collection_select :country_id, available_countries, :id, :name, {}, {:class => 'required'} %> - </span> - </p> +<p class="field" id="bcountry"> + <%= bill_form.label :country_id, t(:country) %><span class="req">*</span><br /> + <span id="bcountry"> + <% + c = session[:zoned] + c = session[:zoned][:current_country] if c + c = c.to_i.abs.to_s if c + c ||= "214" + %> + <%= bill_form.collection_select :country_id, available_countries, :id, :name, + {:selected => c}, + { + :class => 'required', + :data => { + :remote => true, + :url => url_for( + :controller => "zoned", + :action => "setcountry", + ), + } + } + -%> + </span> +</p> - <% if Spree::Config[:address_requires_state] %> - <p class="field" id="bstate"> - <% have_states = !@order.bill_address.country.states.empty? %> - <%= bill_form.label :state, t(:state) %><span class="req">*</span><br /> - <noscript> - <%= bill_form.text_field :state_name, :class => 'required' %> - </noscript> - <% state_elements = [ - bill_form.collection_select(:state_id, @order.bill_address.country.states, - :id, :name, - {:include_blank => true}, - {:class => have_states ? 'required' : 'hidden', - :disabled => !have_states}) + - bill_form.text_field(:state_name, - :class => !have_states ? 'required' : 'hidden', - :disabled => have_states) - ].join.gsub('"', "'").gsub("\n", "") - %> - <%= javascript_tag do -%> - document.write("<%== state_elements %>"); - <% end -%> - </p> - <% end %> +<% if c.to_i == 214 && Spree::Config[:address_requires_state] %> + <p class="field" id="bstate"> + <% co = Spree::Country.find(c.to_i) %> + <% have_states = !co.states.empty? %> + <%= bill_form.label :state, t(:state) %><span class="req">*</span><br /> + <noscript> + <%= bill_form.text_field :state_name, :class => 'required' %> + </noscript> + <% state_elements = [ + bill_form.collection_select(:state_id, co.states, + :id, :name, + {:include_blank => true}, + {:class => have_states ? 'required' : 'hidden', + :disabled => !have_states}) + + bill_form.text_field(:state_name, + :class => !have_states ? 'required' : 'hidden', + :disabled => have_states) + ].join.gsub('"', "'").gsub("\n", "") + %> + <%= javascript_tag do -%> + document.write("<%== state_elements %>"); + <% end -%> + </p> +<% end %> - <p class="field" id="bzipcode"> - <%= bill_form.label :zipcode, t(:zip) %><span class="req">*</span><br /> - <%= bill_form.text_field :zipcode, :class => 'required' %> - </p> - <p class="field" id="bphone"> - <%= bill_form.label :phone, t(:phone) %><span class="req">*</span><br /> - <%= bill_form.text_field :phone, :class => 'required' %> - </p> - <% if Spree::Config[:alternative_billing_phone] %> - <p class="field" id="baltphone"> - <%= bill_form.label :alternative_phone, t(:alternative_phone) %><br /> - <%= bill_form.text_field :alternative_phone %> - </p> - <% end %> - <p class="field checkbox" id="bterms"> - <%= label_tag :order_accept, "#{t(:iaccept)}", :id => 'accept' -%> - <a id="opentos" href=""><%= t(:terms) -%></a><span class="req">*</span><br /> - <%= check_box_tag "order[accept]", '1', false, :class => 'required' %> - </p> - <% end %> - </fieldset> -</div> +<p class="field" id="bzipcode"> + <%= bill_form.label :zipcode, t(:zip) %><span class="req">*</span><br /> + <%= bill_form.text_field :zipcode, :class => 'required' %> +</p> +<p class="field" id="bphone"> + <%= bill_form.label :phone, t(:phone) %><span class="req">*</span><br /> + <%= bill_form.text_field :phone, :class => 'required' %> +</p> +<% if Spree::Config[:alternative_billing_phone] %> + <p class="field" id="baltphone"> + <%= bill_form.label :alternative_phone, t(:alternative_phone) %><br /> + <%= bill_form.text_field :alternative_phone %> + </p> +<% end %> +<p class="field checkbox" id="bterms"> + <%= label_tag :order_accept, "#{t(:iaccept)}", :id => 'accept' -%> + <a id="opentos" href=""><%= t(:terms) -%></a><span class="req">*</span><br /> + <%= check_box_tag "order[accept]", '1', false, :class => 'required' %> +</p>