solidus_frontend 2.5.2 → 2.6.0.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of solidus_frontend might be problematic. Click here for more details.

Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +3 -1
  3. data/app/assets/javascripts/spree/frontend/checkout/address.js +4 -5
  4. data/app/assets/javascripts/spree/frontend/locale_selector.js +5 -0
  5. data/app/assets/javascripts/spree/frontend.js +1 -0
  6. data/app/assets/stylesheets/spree/frontend/screen.css.scss +33 -7
  7. data/app/controllers/spree/checkout_controller.rb +5 -4
  8. data/app/controllers/spree/content_controller.rb +2 -0
  9. data/app/controllers/spree/home_controller.rb +2 -0
  10. data/app/controllers/spree/locale_controller.rb +10 -6
  11. data/app/controllers/spree/orders_controller.rb +3 -1
  12. data/app/controllers/spree/products_controller.rb +3 -1
  13. data/app/controllers/spree/store_controller.rb +2 -0
  14. data/app/controllers/spree/taxons_controller.rb +3 -1
  15. data/app/helpers/spree/orders_helper.rb +2 -0
  16. data/app/helpers/spree/taxon_filters_helper.rb +13 -0
  17. data/app/models/spree/frontend_configuration.rb +2 -0
  18. data/app/views/spree/address/_form.html.erb +33 -33
  19. data/app/views/spree/checkout/_address.html.erb +2 -2
  20. data/app/views/spree/checkout/_delivery.html.erb +1 -1
  21. data/app/views/spree/checkout/_payment.html.erb +3 -3
  22. data/app/views/spree/checkout/edit.html.erb +2 -2
  23. data/app/views/spree/checkout/payment/_gateway.html.erb +12 -13
  24. data/app/views/spree/orders/_form.html.erb +1 -1
  25. data/app/views/spree/shared/_filters.html.erb +1 -1
  26. data/app/views/spree/shared/_locale_selector.html.erb +25 -0
  27. data/app/views/spree/shared/_nav_bar.html.erb +1 -0
  28. data/config/initializers/assets.rb +2 -0
  29. data/config/initializers/canonical_rails.rb +2 -0
  30. data/config/routes.rb +3 -0
  31. data/lib/generators/solidus/views/override_generator.rb +2 -0
  32. data/lib/solidus_frontend.rb +2 -0
  33. data/lib/spree/frontend/engine.rb +2 -0
  34. data/lib/spree/frontend/middleware/seo_assist.rb +2 -0
  35. data/lib/spree/frontend.rb +2 -0
  36. data/lib/spree_frontend.rb +2 -0
  37. data/lib/tasks/rake_util.rb +2 -0
  38. data/lib/tasks/taxon.rake +2 -0
  39. data/script/rails +4 -2
  40. data/solidus_frontend.gemspec +4 -3
  41. data/spec/controllers/controller_helpers_spec.rb +6 -0
  42. data/spec/controllers/locale_controller_spec.rb +57 -0
  43. data/spec/controllers/spree/checkout_controller_spec.rb +2 -0
  44. data/spec/controllers/spree/checkout_controller_with_views_spec.rb +3 -2
  45. data/spec/controllers/spree/content_controller_spec.rb +2 -0
  46. data/spec/controllers/spree/current_order_tracking_spec.rb +2 -0
  47. data/spec/controllers/spree/home_controller_spec.rb +2 -0
  48. data/spec/controllers/spree/orders_controller_ability_spec.rb +2 -0
  49. data/spec/controllers/spree/orders_controller_spec.rb +2 -0
  50. data/spec/controllers/spree/orders_controller_transitions_spec.rb +2 -0
  51. data/spec/controllers/spree/products_controller_spec.rb +2 -0
  52. data/spec/controllers/spree/taxons_controller_spec.rb +2 -0
  53. data/spec/features/address_spec.rb +2 -0
  54. data/spec/features/automatic_promotion_adjustments_spec.rb +2 -0
  55. data/spec/features/caching/products_spec.rb +2 -8
  56. data/spec/features/caching/taxons_spec.rb +2 -2
  57. data/spec/features/cart_spec.rb +2 -0
  58. data/spec/features/checkout_spec.rb +7 -5
  59. data/spec/features/checkout_unshippable_spec.rb +3 -1
  60. data/spec/features/coupon_code_spec.rb +2 -0
  61. data/spec/features/currency_spec.rb +2 -0
  62. data/spec/features/free_shipping_promotions_spec.rb +2 -0
  63. data/spec/features/locale_spec.rb +3 -7
  64. data/spec/features/order_spec.rb +3 -1
  65. data/spec/features/products_spec.rb +4 -3
  66. data/spec/features/promotion_code_invalidation_spec.rb +2 -0
  67. data/spec/features/quantity_promotions_spec.rb +2 -0
  68. data/spec/features/taxons_spec.rb +2 -0
  69. data/spec/features/template_rendering_spec.rb +2 -0
  70. data/spec/generators/solidus/views/override_generator_spec.rb +2 -0
  71. data/spec/helpers/base_helper_spec.rb +2 -0
  72. data/spec/helpers/order_helper_spec.rb +2 -0
  73. data/spec/helpers/taxon_filters_helper_spec.rb +12 -0
  74. data/spec/spec_helper.rb +4 -2
  75. data/spec/support/shared_contexts/checkout_setup.rb +2 -0
  76. data/spec/support/shared_contexts/custom_products.rb +2 -0
  77. data/spec/support/shared_contexts/locales.rb +16 -0
  78. data/spec/views/spree/checkout/_summary_spec.rb +2 -0
  79. metadata +35 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 52d98599c6a656fde974bef0ce0d6adfc02a6018a507afc65a05a321674bb0d5
4
- data.tar.gz: 5c24d7fcfa86263efc7e61ee91862960a8b3ce874b4f1988c556778ab15c285e
3
+ metadata.gz: 2cbda316f20a7ec8eaaf8ceb257f2be0c088698ae84483e45c147cb540549343
4
+ data.tar.gz: 1f4814fdb442ab92bcc8f3afe518240a2307706a27a9e9aabe53af63f449c61d
5
5
  SHA512:
6
- metadata.gz: 9ec539d027c1647ed27b27d5719e080936bb722e2766a5ae4cf33876e126e4045fe239bfb740920ed07639054f0b048217c0a516d7257c8dced4baaea04382e3
7
- data.tar.gz: 397b66411273851c3a4be4c68aefb071798a124e7f1622d8be8618b01b346888c2a3ef788dee5d8a58ca8322d413a6e14c1417dd062fc000411c22ca2f408fea
6
+ metadata.gz: b1cef5e94666087162ce902fb34316830eabd60a7c17f9dec29d326142f69130be56dec9615b872389208b4b4621fc1be350aac11a6c35036ab321471e3b66cb
7
+ data.tar.gz: 96b0f73a8acbc96e70a465bf6919d6c8bda9e425d2aed6478bbfc5c6af097ac5688038edf0eb0379ba3545df61d5d0e42853c91303b20f9e8bd4a4b98a1f61ed
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubygems'
2
4
  require 'rake'
3
5
  require 'rake/testtask'
@@ -8,7 +10,7 @@ RSpec::Core::RakeTask.new
8
10
  task default: :spec
9
11
 
10
12
  DummyApp::RakeTasks.new(
11
- gem_root: File.expand_path('../', __FILE__),
13
+ gem_root: File.expand_path(__dir__),
12
14
  lib_name: 'solidus_frontend'
13
15
  )
14
16
 
@@ -43,7 +43,6 @@ Spree.ready(function($) {
43
43
  var statePara = $("#" + region + "state");
44
44
  var stateSelect = statePara.find("select");
45
45
  var stateInput = statePara.find("input");
46
- var stateSpanRequired = statePara.find('[id$="state-required"]');
47
46
  if (states.length > 0) {
48
47
  var selected = parseInt(stateSelect.val());
49
48
  stateSelect.html("");
@@ -68,21 +67,21 @@ Spree.ready(function($) {
68
67
  statePara.show();
69
68
  if (statesRequired) {
70
69
  stateSelect.addClass("required");
71
- stateSpanRequired.show();
70
+ statePara.addClass("field-required");
72
71
  } else {
73
72
  stateSelect.removeClass("required");
74
- stateSpanRequired.hide();
73
+ statePara.removeClass("field-required");
75
74
  }
76
75
  stateInput.removeClass("required");
77
76
  } else {
78
77
  stateSelect.hide().prop("disabled", true);
79
78
  stateInput.show();
80
79
  if (statesRequired) {
81
- stateSpanRequired.show();
80
+ statePara.addClass("field-required");
82
81
  stateInput.addClass("required");
83
82
  } else {
84
83
  stateInput.val("");
85
- stateSpanRequired.hide();
84
+ statePara.removeClass("field-required");
86
85
  stateInput.removeClass("required");
87
86
  }
88
87
  statePara.toggle(!!statesRequired);
@@ -0,0 +1,5 @@
1
+ $(function() {
2
+ $('#locale_selector select').change(function() {
3
+ this.form.submit();
4
+ });
5
+ });
@@ -2,3 +2,4 @@
2
2
  //= require spree/frontend/checkout
3
3
  //= require spree/frontend/product
4
4
  //= require spree/frontend/cart
5
+ //= require spree/frontend/locale_selector
@@ -143,10 +143,27 @@ label.error {
143
143
  margin-top: 3px;
144
144
  }
145
145
 
146
- span.required {
147
- color: $c_red;
148
- font-weight: bold;
149
- font-size: 1.2em;
146
+ .field {
147
+ padding: 10px 0;
148
+
149
+ label {
150
+ display: inline-block;
151
+ margin-bottom: 5px;
152
+ }
153
+
154
+ input,
155
+ select {
156
+ display: block;
157
+ }
158
+
159
+ &-required label:after {
160
+ content: "*";
161
+ display: inline-block;
162
+ color: $c_red;
163
+ font-weight: bold;
164
+ font-size: 1.2em;
165
+ margin-left: 3px;
166
+ }
150
167
  }
151
168
 
152
169
  fieldset {
@@ -356,9 +373,14 @@ nav#taxonomies {
356
373
  }
357
374
 
358
375
  .taxons-list {
376
+ ul {
377
+ margin-left: 1em;
378
+ }
359
379
  li {
360
- a {
361
- font-size: $main_navigation_font_size
380
+ font-size: $main_navigation_font_size;
381
+ font-weight: normal;
382
+ &.current {
383
+ font-weight: bold;
362
384
  }
363
385
  }
364
386
  }
@@ -640,6 +662,10 @@ ul#products {
640
662
  /*--------------------------------------*/
641
663
  /* Checkout
642
664
  /*--------------------------------------*/
665
+ .checkout_form_wrapper {
666
+ text-align: left;
667
+ }
668
+
643
669
  .out-of-stock {
644
670
  background: #df0000;
645
671
  color: white;
@@ -876,7 +902,7 @@ ul#products {
876
902
  .shipping-methods {
877
903
  list-style: none;
878
904
  margin: 0;
879
- padding: none;
905
+ padding: 10px 0;
880
906
 
881
907
  .shipping-method {
882
908
  display: inline-block;
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spree
2
4
  # This is somewhat contrary to standard REST convention since there is not
3
5
  # actually a Checkout object. There's enough distinct logic specific to
@@ -34,7 +36,6 @@ module Spree
34
36
  return
35
37
  end
36
38
 
37
-
38
39
  if @order.completed?
39
40
  finalize_order
40
41
  else
@@ -88,7 +89,7 @@ module Spree
88
89
  if update_params = massaged_params[:order]
89
90
  update_params.permit(permitted_checkout_attributes)
90
91
  else
91
- # We current allow update requests without any parameters in them.
92
+ # We currently allow update requests without any parameters in them.
92
93
  {}
93
94
  end
94
95
  end
@@ -110,7 +111,7 @@ module Spree
110
111
  def ensure_valid_state
111
112
  unless skip_state_validation?
112
113
  if (params[:state] && !@order.has_checkout_step?(params[:state])) ||
113
- (!params[:state] && !@order.has_checkout_step?(@order.state))
114
+ (!params[:state] && !@order.has_checkout_step?(@order.state))
114
115
  @order.state = 'cart'
115
116
  redirect_to checkout_state_path(@order.checkout_steps.first)
116
117
  end
@@ -174,7 +175,7 @@ module Spree
174
175
  @order.assign_default_user_addresses
175
176
  # If the user has a default address, the previous method call takes care
176
177
  # of setting that; but if he doesn't, we need to build an empty one here
177
- default = {country_id: Spree::Country.default.id}
178
+ default = { country_id: Spree::Country.default.id }
178
179
  @order.build_bill_address(default) unless @order.bill_address
179
180
  @order.build_ship_address(default) if @order.checkout_steps.include?('delivery') && !@order.ship_address
180
181
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spree
2
4
  class ContentController < Spree::StoreController
3
5
  respond_to :html
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spree
2
4
  class HomeController < Spree::StoreController
3
5
  helper 'spree/products'
@@ -1,16 +1,20 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spree
2
4
  class LocaleController < Spree::StoreController
3
5
  def set
4
- if request.referer && request.referer.starts_with?('http://' + request.host)
5
- session['user_return_to'] = request.referer
6
- end
7
- if params[:locale] && I18n.available_locales.map(&:to_s).include?(params[:locale])
8
- session[:locale] = I18n.locale = params[:locale]
6
+ available_locales = Spree.i18n_available_locales
7
+ requested_locale = params[:switch_to_locale] || params[:locale]
8
+
9
+ if requested_locale && available_locales.map(&:to_s).include?(requested_locale)
10
+ session[:locale] = requested_locale
11
+ I18n.locale = requested_locale
9
12
  flash.notice = t('spree.locale_changed')
10
13
  else
11
14
  flash[:error] = t('spree.locale_not_changed')
12
15
  end
13
- redirect_back_or_default(spree.root_path)
16
+
17
+ redirect_to spree.root_path
14
18
  end
15
19
  end
16
20
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spree
2
4
  class OrdersController < Spree::StoreController
3
5
  before_action :check_authorization
@@ -71,7 +73,7 @@ module Spree
71
73
 
72
74
  def populate_redirect
73
75
  flash[:error] = t('spree.populate_get_error')
74
- redirect_to('/cart')
76
+ redirect_to spree.cart_path
75
77
  end
76
78
 
77
79
  def empty
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spree
2
4
  class ProductsController < Spree::StoreController
3
5
  before_action :load_product, only: :show
4
6
  before_action :load_taxon, only: :index
5
7
 
6
- helper 'spree/taxons'
8
+ helper 'spree/taxons', 'spree/taxon_filters'
7
9
 
8
10
  respond_to :html
9
11
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spree
2
4
  class StoreController < Spree::BaseController
3
5
  include Spree::Core::ControllerHelpers::Pricing
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spree
2
4
  class TaxonsController < Spree::StoreController
3
- helper 'spree/products'
5
+ helper 'spree/products', 'spree/taxon_filters'
4
6
 
5
7
  respond_to :html
6
8
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'truncate_html'
2
4
  require 'app/helpers/truncate_html_helper'
3
5
 
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spree/core/product_filters'
4
+
5
+ module Spree
6
+ module TaxonFiltersHelper
7
+ def applicable_filters_for(_taxon)
8
+ [:brand_filter, :price_filter].map do |filter_name|
9
+ Spree::Core::ProductFilters.send(filter_name) if Spree::Core::ProductFilters.respond_to?(filter_name)
10
+ end.compact
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spree
2
4
  class FrontendConfiguration < Preferences::Configuration
3
5
  preference :locale, :string, default: Rails.application.config.i18n.default_locale
@@ -1,39 +1,39 @@
1
1
  <% address_id = address_type.chars.first %>
2
2
  <div class="inner" data-hook=<%="#{address_type}_inner" %>>
3
- <p class="field" id=<%="#{address_id}firstname" %>>
4
- <%= form.label :firstname, t('spree.first_name') %><span class="required">*</span><br />
3
+ <div class="field field-required" id=<%="#{address_id}firstname" %>>
4
+ <%= form.label :firstname, t('spree.first_name') %>
5
5
  <%= form.text_field :firstname, class: 'required', autocomplete: address_type + ' given-name', required: true, autofocus: true %>
6
- </p>
6
+ </div>
7
7
 
8
- <p class="field" id=<%="#{address_id}lastname" %>>
9
- <%= form.label :lastname, t('spree.last_name') %><br />
8
+ <div class="field" id=<%="#{address_id}lastname" %>>
9
+ <%= form.label :lastname, t('spree.last_name') %>
10
10
  <%= form.text_field :lastname, autocomplete: address_type + ' family-name' %>
11
- </p>
11
+ </div>
12
12
 
13
13
  <% if Spree::Config[:company] %>
14
- <p class="field" id=<%="#{address_id}company" %>>
15
- <%= form.label :company, t('spree.company') %><br />
14
+ <div class="field" id=<%="#{address_id}company" %>>
15
+ <%= form.label :company, t('spree.company') %>
16
16
  <%= form.text_field :company, autocomplete: address_type + ' organization' %>
17
- </p>
17
+ </div>
18
18
  <% end %>
19
19
 
20
- <p class="field" id=<%="#{address_id}address1" %>>
21
- <%= form.label :address1, t('spree.street_address') %><span class="required">*</span><br />
20
+ <div class="field field-required" id=<%="#{address_id}address1" %>>
21
+ <%= form.label :address1, t('spree.street_address') %>
22
22
  <%= form.text_field :address1, class: 'required', autocomplete: address_type + ' address-line1', required: true %>
23
- </p>
23
+ </div>
24
24
 
25
- <p class="field" id=<%="#{address_id}address2" %>>
26
- <%= form.label :address2, I18n.t('spree.street_address_2') %><br />
25
+ <div class="field" id=<%="#{address_id}address2" %>>
26
+ <%= form.label :address2, I18n.t('spree.street_address_2') %>
27
27
  <%= form.text_field :address2, autocomplete: address_type + ' address-line2' %>
28
- </p>
28
+ </div>
29
29
 
30
- <p class="field" id=<%="#{address_id}city" %>>
31
- <%= form.label :city, t('spree.city') %><span class="required">*</span><br />
30
+ <div class="field field-required" id=<%="#{address_id}city" %>>
31
+ <%= form.label :city, t('spree.city') %>
32
32
  <%= form.text_field :city, class: 'required', autocomplete: address_type + ' address-level2', required: true %>
33
- </p>
33
+ </div>
34
34
 
35
- <p class="field" id=<%="#{address_id}country" %>>
36
- <%= form.label :country_id, t('spree.country') %><span class="required">*</span><br />
35
+ <div class="field field-required" id=<%="#{address_id}country" %>>
36
+ <%= form.label :country_id, t('spree.country') %>
37
37
  <span id=<%="#{address_id}country-selection" %>>
38
38
  <%= form.collection_select :country_id, available_countries, :id, :name, {},
39
39
  class: 'required',
@@ -41,12 +41,12 @@
41
41
  required: true
42
42
  %>
43
43
  </span>
44
- </p>
44
+ </div>
45
45
 
46
46
  <% if Spree::Config[:address_requires_state] %>
47
- <p class="field" id=<%="#{address_id}state" %>>
47
+ <div class="field field-required" id=<%="#{address_id}state" %>>
48
48
  <% have_states = !address.country.states.empty? %>
49
- <%= form.label :state, t('spree.state') %><span class='required' id=<%="#{address_id}state-required"%>>*</span><br/>
49
+ <%= form.label :state, t('spree.state') %>
50
50
 
51
51
  <span class="js-address-fields" style="display: none;">
52
52
  <%=
@@ -73,24 +73,24 @@
73
73
  <noscript>
74
74
  <%= form.text_field :state_name, class: 'required', autocomplete: address_type + ' address-level1', required: true %>
75
75
  </noscript>
76
- </p>
76
+ </div>
77
77
  <% end %>
78
78
 
79
- <p class="field" id=<%="#{address_id}zipcode" %>>
80
- <%= form.label :zipcode, t('spree.zip') %><% if address.require_zipcode? %><span class="required">*</span><% end %><br />
79
+ <div class="field <%= 'field-required' if address.require_zipcode? %>" id=<%="#{address_id}zipcode" %>>
80
+ <%= form.label :zipcode, t('spree.zip') %>
81
81
  <%= form.text_field :zipcode, class: "#{'required' if address.require_zipcode?}", autocomplete: address_type + ' postal-code', required: true %>
82
- </p>
82
+ </div>
83
83
 
84
- <p class="field" id=<%="#{address_id}phone" %>>
85
- <%= form.label :phone, t('spree.phone') %><% if address.require_phone? %><span class="required">*</span><% end %><br />
84
+ <div class="field <%= 'field-required' if address.require_phone? %>" id=<%="#{address_id}phone" %>>
85
+ <%= form.label :phone, t('spree.phone') %>
86
86
  <% phone_hash = address.require_phone? ? { class: 'required', required: true } : {} %>
87
87
  <%= form.phone_field :phone, phone_hash.merge({ autocomplete: address_type + ' home tel' }) %>
88
- </p>
88
+ </div>
89
89
 
90
90
  <% if Spree::Config[:alternative_shipping_phone] %>
91
- <p class="field" id=<%="#{address_id}altphone" %>>
92
- <%= form.label :alternative_phone, t('spree.alternative_phone') %><br />
91
+ <div class="field" id=<%="#{address_id}altphone" %>>
92
+ <%= form.label :alternative_phone, t('spree.alternative_phone') %>
93
93
  <%= form.phone_field :alternative_phone, autocomplete: address_type + ' tel'%>
94
- </p>
94
+ </div>
95
95
  <% end %>
96
96
  </div>
@@ -11,10 +11,10 @@
11
11
  <fieldset id="shipping" data-hook>
12
12
  <%= form.fields_for :ship_address do |ship_form| %>
13
13
  <legend align="center"><%= t('spree.shipping_address') %></legend>
14
- <p class="field checkbox" data-hook="use_billing">
14
+ <div class="checkbox" data-hook="use_billing">
15
15
  <%= check_box_tag 'order[use_billing]', '1', @order.shipping_eq_billing_address? %>
16
16
  <%= label_tag :order_use_billing, t('spree.use_billing_address'), id: 'use_billing' %>
17
- </p>
17
+ </div>
18
18
  <%= render partial: 'spree/address/form', locals: { form: ship_form, address_type: 'shipping', address: @order.ship_address } %>
19
19
  <% end %>
20
20
  </fieldset>
@@ -38,7 +38,7 @@
38
38
  </table>
39
39
 
40
40
  <h5 class="stock-shipping-method-title"><%= t('spree.shipping_method') %></h5>
41
- <ul class="field radios shipping-methods">
41
+ <ul class="radios shipping-methods">
42
42
  <% ship_form.object.shipping_rates.each do |rate| %>
43
43
  <li class="shipping-method">
44
44
  <label>
@@ -15,7 +15,7 @@
15
15
  </div>
16
16
 
17
17
  <div id="existing_cards">
18
- <p class="field" data-hook="existing_cards">
18
+ <div class="field" data-hook="existing_cards">
19
19
  <table class="existing-credit-card-list">
20
20
  <tbody>
21
21
  <% @wallet_payment_sources.each do |wallet_payment_source| %>
@@ -31,7 +31,7 @@
31
31
  <% end %>
32
32
  </tbody>
33
33
  </table>
34
- </p>
34
+ </div>
35
35
  </div>
36
36
  <% end %>
37
37
 
@@ -57,7 +57,7 @@
57
57
  </ul>
58
58
  <br style="clear:both;" />
59
59
  <p class='field' data-hook='coupon_code'>
60
- <%= form.label :coupon_code %><br />
60
+ <%= form.label :coupon_code %>
61
61
  <%= form.text_field :coupon_code %>
62
62
  <button type="button" class="button" id="coupon-code-apply-button">
63
63
  <%= t('spree.apply_code') %>
@@ -10,10 +10,10 @@
10
10
  <div class="columns <%= if @order.state != 'confirm' then 'alpha twelve' else 'alpha omega sixteen' end %>" data-hook="checkout_form_wrapper">
11
11
  <%= form_for @order, url: update_checkout_path(@order.state), html: { id: "checkout_form_#{@order.state}" } do |form| %>
12
12
  <% if @order.state == 'address' || !@order.email? %>
13
- <p class="field" style='clear: both'>
13
+ <div class="field field-required" style='clear: both'>
14
14
  <%= form.label :email %><br />
15
15
  <%= form.email_field :email, required: true %>
16
- </p>
16
+ </div>
17
17
  <% end %>
18
18
  <%= render @order.state, form: form %>
19
19
  <% end %>
@@ -1,32 +1,31 @@
1
1
  <%= image_tag 'credit_cards/credit_card.gif', id: 'credit-card-image' %>
2
2
  <% param_prefix = "payment_source[#{payment_method.id}]" %>
3
3
 
4
- <p class="field">
5
- <%= label_tag "name_on_card_#{payment_method.id}", t('spree.name_on_card') %><span class="required">*</span><br />
4
+ <div class="field field-required">
5
+ <%= label_tag "name_on_card_#{payment_method.id}", t('spree.name_on_card') %>
6
6
  <%= text_field_tag "#{param_prefix}[name]", "#{@order.billing_firstname} #{@order.billing_lastname}", { id: "name_on_card_#{payment_method.id}", autocomplete: "cc-name" } %>
7
- </p>
7
+ </div>
8
8
 
9
- <p class="field" data-hook="card_number">
10
- <%= label_tag "card_number", t('spree.card_number') %><span class="required">*</span><br />
9
+ <div class="field field-required" data-hook="card_number">
10
+ <%= label_tag "card_number", t('spree.card_number') %>
11
11
  <%= text_field_tag "#{param_prefix}[number]", '', {id: 'card_number', class: 'required cardNumber', size: 19, maxlength: 19, autocomplete: "cc-number", type: "tel" } %>
12
- &nbsp;
13
12
  <span id="card_type" style="display:none;">
14
13
  ( <span id="looks_like" ><%= t('spree.card_type_is') %> <span id="type"></span></span>
15
14
  <span id="unrecognized"><%= t('spree.unrecognized_card_type') %></span>
16
15
  )
17
16
  </span>
18
- </p>
17
+ </div>
19
18
 
20
- <p class="field" data-hook="card_expiration">
21
- <%= label_tag "card_expiry", t('spree.expiration') %><span class="required">*</span><br />
19
+ <div class="field field-required" data-hook="card_expiration">
20
+ <%= label_tag "card_expiry", t('spree.expiration') %>
22
21
  <%= text_field_tag "#{param_prefix}[expiry]", '', id: 'card_expiry', class: "required cardExpiry", placeholder: "MM / YY", type: "tel" %>
23
- </p>
22
+ </div>
24
23
 
25
- <p class="field" data-hook="card_code">
26
- <%= label_tag "card_code", t('spree.card_code') %><span class="required">*</span><br />
24
+ <div class="field field-required" data-hook="card_code">
25
+ <%= label_tag "card_code", t('spree.card_code') %>
27
26
  <%= text_field_tag "#{param_prefix}[verification_value]", '', {id: 'card_code', class: 'required cardCode', size: 5, type: "tel", autocomplete: "off" } %>
28
27
  <%= link_to "(#{t('spree.what_is_this')})", spree.cvv_path, target: '_blank', "data-hook" => "cvv_link", id: "cvv_link" %>
29
- </p>
28
+ </div>
30
29
 
31
30
  <% if @order.bill_address %>
32
31
  <%= fields_for "#{param_prefix}[address_attributes]", @order.bill_address do |f| %>
@@ -22,7 +22,7 @@
22
22
  <%= render "spree/orders/adjustments" %>
23
23
  <% end %>
24
24
  <tr class="cart-total">
25
- <td colspan="4" align='right'><h5><%= t('spree.total') %></h5></th>
25
+ <td colspan="4" align='right'><h5><%= t('spree.total') %></h5></td>
26
26
  <td colspan><h5><%= order.display_total %></h5></td>
27
27
  <td></td>
28
28
  </tr>
@@ -1,4 +1,4 @@
1
- <% filters = @taxon.applicable_filters %>
1
+ <% filters = applicable_filters_for(@taxon) %>
2
2
  <% unless filters.empty? %>
3
3
  <%= form_tag '', method: :get, id: 'sidebar_products_search' do %>
4
4
  <%= hidden_field_tag 'per_page', params[:per_page] %>
@@ -0,0 +1,25 @@
1
+ <% available_locales = current_store.available_locales %>
2
+ <% if available_locales.many? %>
3
+ <li id="locale_selector" data-hook>
4
+ <%= form_tag spree.select_locale_path, class: 'navbar-form' do %>
5
+ <div class="form-group">
6
+ <label for="switch_to_locale" class="sr-only">
7
+ <%= Spree.t(:'i18n.language') %>
8
+ </label>
9
+ <%=
10
+ select_tag(
11
+ :switch_to_locale,
12
+ options_for_select(
13
+ available_locales.map do |locale|
14
+ [I18n.t('spree.i18n.this_file_language', locale: locale, default: locale.to_s, fallback: false), locale]
15
+ end.sort,
16
+ selected: I18n.locale
17
+ ),
18
+ class: 'form-control'
19
+ )
20
+ %>
21
+ <noscript><%= submit_tag t("spree.select") %></noscript>
22
+ </div>
23
+ <% end %>
24
+ </li>
25
+ <% end %>
@@ -1,5 +1,6 @@
1
1
  <nav id="top-nav-bar" class="columns ten">
2
2
  <ul id="nav-bar" class="inline" data-hook>
3
+ <%= render 'spree/shared/locale_selector' %>
3
4
  <%= render 'spree/shared/login_bar_items' %>
4
5
  <li id="search-bar" data-hook>
5
6
  <%= render partial: 'spree/shared/search' %>
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Rails.application.config.assets.precompile << 'solidus_frontend_manifest.js'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  CanonicalRails.setup do |config|
2
4
  # http://en.wikipedia.org/wiki/URL_normalization
3
5
  # Trailing slash represents semantics of a directory, ie a collection view - implying an :index get route;
data/config/routes.rb CHANGED
@@ -1,9 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Spree::Core::Engine.routes.draw do
2
4
  root to: 'home#index'
3
5
 
4
6
  resources :products, only: [:index, :show]
5
7
 
6
8
  get '/locale/set', to: 'locale#set'
9
+ post '/locale/set', to: 'locale#set', as: :select_locale
7
10
 
8
11
  # non-restful checkout stuff
9
12
  patch '/checkout/update/:state', to: 'checkout#update', as: :update_checkout
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rails'
2
4
  require 'rails/generators'
3
5
 
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spree_frontend'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spree
2
4
  module Frontend
3
5
  class Engine < ::Rails::Engine
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Make redirects for SEO needs
2
4
  module Spree
3
5
  module Frontend
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rails/all'
2
4
  require 'jquery-rails'
3
5
  require 'canonical-rails'