diff --git a/frontend/app/assets/javascripts/spree/frontend/checkout/address.js b/frontend/app/assets/javascripts/spree/frontend/checkout/address.js index 5dc00423725..2f8e6f18d57 100644 --- a/frontend/app/assets/javascripts/spree/frontend/checkout/address.js +++ b/frontend/app/assets/javascripts/spree/frontend/checkout/address.js @@ -43,7 +43,6 @@ Spree.ready(function($) { var statePara = $("#" + region + "state"); var stateSelect = statePara.find("select"); var stateInput = statePara.find("input"); - var stateSpanRequired = statePara.find('[id$="state-required"]'); if (states.length > 0) { var selected = parseInt(stateSelect.val()); stateSelect.html(""); @@ -68,21 +67,21 @@ Spree.ready(function($) { statePara.show(); if (statesRequired) { stateSelect.addClass("required"); - stateSpanRequired.show(); + statePara.addClass("field-required"); } else { stateSelect.removeClass("required"); - stateSpanRequired.hide(); + statePara.removeClass("field-required"); } stateInput.removeClass("required"); } else { stateSelect.hide().prop("disabled", true); stateInput.show(); if (statesRequired) { - stateSpanRequired.show(); + statePara.addClass("field-required"); stateInput.addClass("required"); } else { stateInput.val(""); - stateSpanRequired.hide(); + statePara.removeClass("field-required"); stateInput.removeClass("required"); } statePara.toggle(!!statesRequired); diff --git a/frontend/app/assets/stylesheets/spree/frontend/screen.css.scss b/frontend/app/assets/stylesheets/spree/frontend/screen.css.scss index 4da8f5d1c16..8e53f9cd207 100644 --- a/frontend/app/assets/stylesheets/spree/frontend/screen.css.scss +++ b/frontend/app/assets/stylesheets/spree/frontend/screen.css.scss @@ -143,10 +143,27 @@ label.error { margin-top: 3px; } -span.required { - color: $c_red; - font-weight: bold; - font-size: 1.2em; +.field { + padding: 10px 0; + + label { + display: inline-block; + margin-bottom: 5px; + } + + input, + select { + display: block; + } + + &-required label:after { + content: "*"; + display: inline-block; + color: $c_red; + font-weight: bold; + font-size: 1.2em; + margin-left: 3px; + } } fieldset { @@ -640,6 +657,10 @@ ul#products { /*--------------------------------------*/ /* Checkout /*--------------------------------------*/ +.checkout_form_wrapper { + text-align: left; +} + .out-of-stock { background: #df0000; color: white; @@ -876,7 +897,7 @@ ul#products { .shipping-methods { list-style: none; margin: 0; - padding: none; + padding: 10px 0; .shipping-method { display: inline-block; diff --git a/frontend/app/views/spree/address/_form.html.erb b/frontend/app/views/spree/address/_form.html.erb index 6710c1564f5..2b38b7720b2 100644 --- a/frontend/app/views/spree/address/_form.html.erb +++ b/frontend/app/views/spree/address/_form.html.erb @@ -1,39 +1,39 @@ <% address_id = address_type.chars.first %>
> -

> - <%= form.label :firstname, t('spree.first_name') %>*
+

> + <%= form.label :firstname, t('spree.first_name') %> <%= form.text_field :firstname, class: 'required', autocomplete: address_type + ' given-name', required: true, autofocus: true %> -

+
-

> - <%= form.label :lastname, t('spree.last_name') %>
+

> + <%= form.label :lastname, t('spree.last_name') %> <%= form.text_field :lastname, autocomplete: address_type + ' family-name' %> -

+
<% if Spree::Config[:company] %> -

> - <%= form.label :company, t('spree.company') %>
+

> + <%= form.label :company, t('spree.company') %> <%= form.text_field :company, autocomplete: address_type + ' organization' %> -

+
<% end %> -

> - <%= form.label :address1, t('spree.street_address') %>*
+

> + <%= form.label :address1, t('spree.street_address') %> <%= form.text_field :address1, class: 'required', autocomplete: address_type + ' address-line1', required: true %> -

+
-

> - <%= form.label :address2, I18n.t('spree.street_address_2') %>
+

> + <%= form.label :address2, I18n.t('spree.street_address_2') %> <%= form.text_field :address2, autocomplete: address_type + ' address-line2' %> -

+
-

> - <%= form.label :city, t('spree.city') %>*
+

> + <%= form.label :city, t('spree.city') %> <%= form.text_field :city, class: 'required', autocomplete: address_type + ' address-level2', required: true %> -

+
-

> - <%= form.label :country_id, t('spree.country') %>*
+

> + <%= form.label :country_id, t('spree.country') %> > <%= form.collection_select :country_id, available_countries, :id, :name, {}, class: 'required', @@ -41,12 +41,12 @@ required: true %> -

+
<% if Spree::Config[:address_requires_state] %> -

> +

> <% have_states = !address.country.states.empty? %> - <%= form.label :state, t('spree.state') %>>*
+ <%= form.label :state, t('spree.state') %>
<% end %> -

> - <%= form.label :zipcode, t('spree.zip') %><% if address.require_zipcode? %>*<% end %>
+

> + <%= form.label :zipcode, t('spree.zip') %> <%= form.text_field :zipcode, class: "#{'required' if address.require_zipcode?}", autocomplete: address_type + ' postal-code', required: true %> -

+
-

> - <%= form.label :phone, t('spree.phone') %><% if address.require_phone? %>*<% end %>
+

> + <%= form.label :phone, t('spree.phone') %> <% phone_hash = address.require_phone? ? { class: 'required', required: true } : {} %> <%= form.phone_field :phone, phone_hash.merge({ autocomplete: address_type + ' home tel' }) %> -

+
<% if Spree::Config[:alternative_shipping_phone] %> -

> - <%= form.label :alternative_phone, t('spree.alternative_phone') %>
+

> + <%= form.label :alternative_phone, t('spree.alternative_phone') %> <%= form.phone_field :alternative_phone, autocomplete: address_type + ' tel'%> -

+
<% end %>
diff --git a/frontend/app/views/spree/checkout/_address.html.erb b/frontend/app/views/spree/checkout/_address.html.erb index 9f2d2a25527..58f73fc5c54 100644 --- a/frontend/app/views/spree/checkout/_address.html.erb +++ b/frontend/app/views/spree/checkout/_address.html.erb @@ -11,10 +11,10 @@
<%= form.fields_for :ship_address do |ship_form| %> <%= t('spree.shipping_address') %> -

+

<%= check_box_tag 'order[use_billing]', '1', @order.shipping_eq_billing_address? %> <%= label_tag :order_use_billing, t('spree.use_billing_address'), id: 'use_billing' %> -

+
<%= render partial: 'spree/address/form', locals: { form: ship_form, address_type: 'shipping', address: @order.ship_address } %> <% end %>
diff --git a/frontend/app/views/spree/checkout/_delivery.html.erb b/frontend/app/views/spree/checkout/_delivery.html.erb index e1ff12c3ec8..ec02f505dec 100644 --- a/frontend/app/views/spree/checkout/_delivery.html.erb +++ b/frontend/app/views/spree/checkout/_delivery.html.erb @@ -38,7 +38,7 @@
<%= t('spree.shipping_method') %>
-