spree_frontend 4.2.0.rc1 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spree/frontend.js +11 -1
  3. data/app/assets/javascripts/spree/frontend/account.js +1 -1
  4. data/app/assets/javascripts/spree/frontend/cart.js +24 -2
  5. data/app/assets/javascripts/spree/frontend/checkout/address.js +60 -43
  6. data/app/assets/javascripts/spree/frontend/checkout/shipment.js +15 -2
  7. data/app/assets/javascripts/spree/frontend/coupon_manager.js +2 -2
  8. data/app/assets/javascripts/spree/frontend/currency.js +11 -0
  9. data/app/assets/javascripts/spree/frontend/locale.js +11 -0
  10. data/app/assets/javascripts/spree/frontend/views/spree/product/related.js +2 -2
  11. data/app/assets/javascripts/spree/frontend/views/spree/products/cart_form.js +1 -1
  12. data/app/assets/stylesheets/spree/frontend/application.scss +0 -3
  13. data/app/assets/stylesheets/spree/frontend/functions.scss +1 -0
  14. data/app/assets/stylesheets/spree/frontend/variables/bootstrap-overrides.scss +2 -2
  15. data/app/assets/stylesheets/spree/frontend/variables/helper-variables.scss +1 -0
  16. data/app/assets/stylesheets/spree/frontend/variables/variables.scss +54 -0
  17. data/app/assets/stylesheets/spree/frontend/views/spree/checkout/confirm.scss +27 -22
  18. data/app/assets/stylesheets/spree/frontend/views/spree/checkout/edit.scss +3 -0
  19. data/app/assets/stylesheets/spree/frontend/views/spree/orders/show.scss +3 -0
  20. data/app/controllers/concerns/spree/checkout/address_book.rb +9 -7
  21. data/app/controllers/concerns/spree/locale_urls.rb +23 -0
  22. data/app/controllers/spree/addresses_controller.rb +1 -0
  23. data/app/controllers/spree/checkout_controller.rb +8 -8
  24. data/app/controllers/spree/currency_controller.rb +6 -10
  25. data/app/controllers/spree/home_controller.rb +5 -1
  26. data/app/controllers/spree/locale_controller.rb +23 -6
  27. data/app/controllers/spree/orders_controller.rb +2 -2
  28. data/app/controllers/spree/products_controller.rb +6 -5
  29. data/app/controllers/spree/store_controller.rb +7 -13
  30. data/app/controllers/spree/taxons_controller.rb +4 -3
  31. data/app/helpers/spree/addresses_helper.rb +19 -8
  32. data/app/helpers/spree/cache_helper.rb +7 -0
  33. data/app/helpers/spree/frontend_helper.rb +17 -25
  34. data/app/helpers/spree/navigation_helper.rb +6 -1
  35. data/app/helpers/spree/store_helper.rb +39 -0
  36. data/app/helpers/spree/taxons_helper.rb +1 -1
  37. data/app/models/spree/frontend_configuration.rb +2 -1
  38. data/app/views/kaminari/twitter-bootstrap-4/_first_page.html.erb +2 -2
  39. data/app/views/kaminari/twitter-bootstrap-4/_gap.html.erb +2 -2
  40. data/app/views/kaminari/twitter-bootstrap-4/_last_page.html.erb +2 -2
  41. data/app/views/kaminari/twitter-bootstrap-4/_next_page.html.erb +2 -2
  42. data/app/views/kaminari/twitter-bootstrap-4/_page.html.erb +2 -2
  43. data/app/views/kaminari/twitter-bootstrap-4/_paginator.html.erb +2 -2
  44. data/app/views/kaminari/twitter-bootstrap-4/_prev_page.html.erb +2 -2
  45. data/app/views/spree/address/_form.html.erb +15 -16
  46. data/app/views/spree/addresses/_form.html.erb +1 -1
  47. data/app/views/spree/addresses/edit.html.erb +2 -2
  48. data/app/views/spree/addresses/new.html.erb +2 -2
  49. data/app/views/spree/checkout/_address.html.erb +4 -6
  50. data/app/views/spree/checkout/_confirm.html.erb +1 -33
  51. data/app/views/spree/checkout/_credit_card.html.erb +2 -2
  52. data/app/views/spree/checkout/_delivery_informations.html.erb +43 -36
  53. data/app/views/spree/checkout/_summary.html.erb +3 -5
  54. data/app/views/spree/checkout/payment/_gateway.html.erb +1 -1
  55. data/app/views/spree/home/index.html.erb +21 -22
  56. data/app/views/spree/locale/index.html.erb +1 -0
  57. data/app/views/spree/orders/_coupon_code.html.erb +2 -3
  58. data/app/views/spree/orders/_line_item.html.erb +2 -2
  59. data/app/views/spree/orders/_line_item_data.html.erb +2 -2
  60. data/app/views/spree/orders/edit.html.erb +2 -3
  61. data/app/views/spree/orders/show.html.erb +1 -71
  62. data/app/views/spree/products/_cart_form.html.erb +4 -7
  63. data/app/views/spree/products/_color_option_type.html.erb +2 -3
  64. data/app/views/spree/products/_filters_desktop.html.erb +1 -2
  65. data/app/views/spree/products/_gallery.html.erb +4 -6
  66. data/app/views/spree/products/_gallery_modal.html.erb +3 -5
  67. data/app/views/spree/products/_option_type.html.erb +1 -2
  68. data/app/views/spree/products/_sort_mobile.html.erb +4 -4
  69. data/app/views/spree/products/related.html.erb +11 -5
  70. data/app/views/spree/products/show.html.erb +1 -5
  71. data/app/views/spree/shared/_carousel_4_products.html.erb +6 -12
  72. data/app/views/spree/shared/_color_select.html.erb +3 -3
  73. data/app/views/spree/shared/_currency_dropdown.html.erb +13 -0
  74. data/app/views/spree/shared/_delete_address_popup.html.erb +1 -2
  75. data/app/views/spree/shared/_error_messages.html.erb +2 -2
  76. data/app/views/spree/shared/_footer.html.erb +4 -4
  77. data/app/views/spree/shared/_head.html.erb +5 -1
  78. data/app/views/spree/shared/_header.html.erb +1 -1
  79. data/app/views/spree/shared/_internationalization_options.html.erb +31 -0
  80. data/app/views/spree/shared/_line_item.html.erb +2 -2
  81. data/app/views/spree/shared/_link_to_account.html.erb +5 -5
  82. data/app/views/spree/shared/_locale_dropdown.html.erb +13 -0
  83. data/app/views/spree/shared/_login.html.erb +1 -1
  84. data/app/views/spree/shared/_main_nav_bar.html.erb +1 -1
  85. data/app/views/spree/shared/_mobile_internationalization_options.html.erb +37 -0
  86. data/app/views/spree/shared/_mobile_navigation.html.erb +3 -6
  87. data/app/views/spree/shared/_nav_bar.html.erb +5 -5
  88. data/app/views/spree/shared/_no_product_available.html.erb +1 -1
  89. data/app/views/spree/shared/_option_values.html.erb +1 -1
  90. data/app/views/spree/shared/_order_details.html.erb +117 -174
  91. data/app/views/spree/shared/_payment.html.erb +2 -2
  92. data/app/views/spree/shared/_payment_sources.html.erb +2 -2
  93. data/app/views/spree/shared/_product_added_modal.html.erb +1 -1
  94. data/app/views/spree/shared/_search.html.erb +1 -2
  95. data/app/views/spree/shared/_translations.html.erb +6 -6
  96. data/app/views/spree/shared/carousel/_single.html.erb +6 -11
  97. data/app/views/spree/shared/carousel/_thumbnails.html.erb +5 -11
  98. data/app/views/spree/users/_address.html.erb +1 -1
  99. data/app/views/spree/users/_address_controls.html.erb +1 -2
  100. data/app/views/spree/users/show.html.erb +4 -4
  101. data/config/initializers/canonical_rails.rb +1 -1
  102. data/config/routes.rb +26 -30
  103. data/lib/generators/spree/frontend/copy_storefront/copy_storefront_generator.rb +1 -7
  104. data/lib/generators/spree/frontend/install/install_generator.rb +34 -0
  105. data/lib/generators/spree/frontend/install/templates/config/initializers/spree_storefront.rb +1 -0
  106. data/lib/generators/spree/frontend/install/templates/config/spree_storefront.yml +99 -0
  107. data/spree_frontend.gemspec +2 -2
  108. metadata +27 -19
  109. data/app/views/spree/products/_vendor_info.html.erb +0 -13
  110. data/app/views/spree/shared/_change_store.html.erb +0 -25
  111. data/app/views/spree/shared/_mobile_change_store.html.erb +0 -30
  112. data/app/views/spree/shared/forbidden.html.erb +0 -0
  113. data/app/views/spree/shared/unauthorized.html.erb +0 -0
@@ -10,7 +10,7 @@ module Spree
10
10
  method_name = I18n.t("activerecord.attributes.spree/address.#{method}")
11
11
  required = Spree.t(:required)
12
12
  form.text_field(method,
13
- class: [is_required ? 'required' : nil, 'spree-flat-input'].compact,
13
+ class: ['spree-flat-input'].compact,
14
14
  required: is_required,
15
15
  placeholder: is_required ? "#{method_name} #{required}" : method_name,
16
16
  aria: { label: method_name }) +
@@ -27,7 +27,7 @@ module Spree
27
27
  method_name = Spree.t(:zipcode)
28
28
  required = Spree.t(:required)
29
29
  form.text_field(:zipcode,
30
- class: [is_required ? 'required' : nil, 'spree-flat-input'].compact,
30
+ class: ['spree-flat-input'].compact,
31
31
  required: is_required,
32
32
  placeholder: is_required ? "#{method_name} #{required}" : method_name,
33
33
  aria: { label: Spree.t(:zipcode) }) +
@@ -41,14 +41,14 @@ module Spree
41
41
  country ||= Spree::Country.find(Spree::Config[:default_country_id])
42
42
  have_states = country.states.any?
43
43
  state_elements = [
44
- form.collection_select(:state_id, country.states.order(:name),
44
+ form.collection_select(:state_id, checkout_zone_applicable_states_for(country).sort_by(&:name),
45
45
  :id, :name,
46
46
  { prompt: Spree.t(:state) },
47
- class: [have_states ? 'required' : 'hidden', 'spree-flat-select'].compact,
47
+ class: ['spree-flat-select'].compact,
48
48
  aria: { label: Spree.t(:state) },
49
49
  disabled: !have_states) +
50
50
  form.text_field(:state_name,
51
- class: [!have_states ? 'required' : 'hidden', 'spree-flat-input'].compact,
51
+ class: ['spree-flat-input'].compact,
52
52
  aria: { label: Spree.t(:state) },
53
53
  disabled: have_states,
54
54
  placeholder: Spree.t(:state) + " #{Spree.t(:required)}") +
@@ -60,14 +60,25 @@ module Spree
60
60
  class: [!have_states ? 'hidden' : nil, 'position-absolute spree-flat-select-arrow'].compact)
61
61
  ].join.tr('"', "'").delete("\n")
62
62
 
63
- content_tag(:noscript, form.text_field(:state_name, class: 'required')) +
63
+ content_tag(:noscript, form.text_field(:state_name)) +
64
64
  javascript_tag("document.write(\"<span class='d-block position-relative'>#{state_elements.html_safe}</span>\");")
65
65
  end
66
66
 
67
67
  def user_available_addresses
68
- return unless try_spree_current_user
68
+ @user_available_addresses ||= begin
69
+ return [] unless try_spree_current_user
69
70
 
70
- try_spree_current_user.addresses.where(country: available_countries)
71
+ states = current_store.countries_available_for_checkout.each_with_object([]) do |country, memo|
72
+ memo << current_store.states_available_for_checkout(country)
73
+ end.flatten
74
+
75
+ try_spree_current_user.addresses.
76
+ where(country_id: states.pluck(:country_id).uniq)
77
+ end
78
+ end
79
+
80
+ def checkout_zone_applicable_states_for(country)
81
+ current_store.states_available_for_checkout(country)
71
82
  end
72
83
  end
73
84
  end
@@ -0,0 +1,7 @@
1
+ module Spree
2
+ module CacheHelper
3
+ def http_cache_enabled?
4
+ @http_cache_enabled ||= Spree::Frontend::Config[:http_cache_enabled]
5
+ end
6
+ end
7
+ end
@@ -7,26 +7,6 @@ module Spree
7
7
  @body_class
8
8
  end
9
9
 
10
- def store_country_iso(store)
11
- store ||= current_store
12
- return unless store
13
- return unless store.default_country
14
-
15
- store.default_country.iso.downcase
16
- end
17
-
18
- def stores
19
- @stores ||= Spree::Store.includes(:default_country)
20
- end
21
-
22
- def store_currency_symbol(store)
23
- store ||= current_store
24
- return unless store
25
- return unless store.default_currency
26
-
27
- ::Money::Currency.find(store.default_currency).symbol
28
- end
29
-
30
10
  def spree_breadcrumbs(taxon, _separator = '', product = nil)
31
11
  return '' if current_page?('/') || taxon.nil?
32
12
 
@@ -248,7 +228,7 @@ module Spree
248
228
  end
249
229
 
250
230
  def price_filter_values
251
- [
231
+ @price_filter_values ||= [
252
232
  "#{I18n.t('activerecord.attributes.spree/product.less_than')} #{formatted_price(50)}",
253
233
  "#{formatted_price(50)} - #{formatted_price(100)}",
254
234
  "#{formatted_price(101)} - #{formatted_price(150)}",
@@ -274,12 +254,12 @@ module Spree
274
254
  end
275
255
 
276
256
  def available_option_types_cache_key
277
- @available_option_types_cache_key ||= Spree::OptionType.maximum(:updated_at)&.utc&.to_i
257
+ @available_option_types_cache_key ||= Spree::OptionType.filterable.maximum(:updated_at)&.utc&.to_i
278
258
  end
279
259
 
280
260
  def available_option_types
281
261
  @available_option_types ||= Rails.cache.fetch("available-option-types/#{available_option_types_cache_key}") do
282
- Spree::OptionType.includes(:option_values).to_a
262
+ Spree::OptionType.includes(:option_values).filterable.to_a
283
263
  end
284
264
  @available_option_types
285
265
  end
@@ -295,7 +275,17 @@ module Spree
295
275
  end
296
276
 
297
277
  def checkout_available_payment_methods
298
- @order.available_payment_methods(current_store)
278
+ @checkout_available_payment_methods ||= @order.available_payment_methods(current_store)
279
+ end
280
+
281
+ def color_option_type_name
282
+ @color_option_type_name ||= Spree::OptionType.color&.name
283
+ end
284
+
285
+ def country_flag_icon(country_iso_code = nil)
286
+ return if country_iso_code.blank?
287
+
288
+ content_tag :span, nil, class: "flag-icon flag-icon-#{country_iso_code.downcase}"
299
289
  end
300
290
 
301
291
  private
@@ -314,7 +304,9 @@ module Spree
314
304
  end
315
305
  end
316
306
 
317
- def checkout_edit_link(step = 'address')
307
+ def checkout_edit_link(step = 'address', order = @order)
308
+ return if order.complete?
309
+
318
310
  classes = 'align-text-bottom checkout-confirm-delivery-informations-link'
319
311
 
320
312
  link_to spree.checkout_state_path(step), class: classes, method: :get do
@@ -3,7 +3,7 @@ require 'digest'
3
3
  module Spree
4
4
  module NavigationHelper
5
5
  def spree_navigation_data
6
- SpreeStorefrontConfig.dig(current_store.code, :navigation) || SpreeStorefrontConfig.dig(:default, :navigation) || []
6
+ @spree_navigation_data ||= SpreeStorefrontConfig.dig(I18n.locale, :navigation) || SpreeStorefrontConfig.dig(current_store.code, :navigation) || SpreeStorefrontConfig.dig(:default, :navigation) || []
7
7
  # safeguard for older Spree installs that don't have spree_navigation initializer
8
8
  # or spree.yml file present
9
9
  rescue
@@ -28,6 +28,11 @@ module Spree
28
28
  )
29
29
  end
30
30
 
31
+ def should_render_internationalization_dropdown?
32
+ (defined?(should_render_locale_dropdown?) && should_render_locale_dropdown?) ||
33
+ (defined?(should_render_currency_dropdown?) && should_render_currency_dropdown?)
34
+ end
35
+
31
36
  private
32
37
 
33
38
  def spree_navigation_data_cache_key
@@ -0,0 +1,39 @@
1
+ module Spree
2
+ module StoreHelper
3
+ def store_country_iso(store = nil)
4
+ store ||= current_store if defined?(current_store)
5
+
6
+ store&.default_country&.iso&.downcase
7
+ end
8
+
9
+ def stores
10
+ @stores ||= Spree::Store.includes(:default_country).order(:id)
11
+ end
12
+
13
+ def store_currency_symbol(store = nil)
14
+ store ||= current_store if defined?(current_store)
15
+ return unless store&.default_currency
16
+
17
+ ::Money::Currency.find(store.default_currency).symbol
18
+ end
19
+
20
+ def store_locale_name(store = nil)
21
+ store ||= current_store if defined?(current_store)
22
+ return unless store
23
+ return store.name if store.default_locale.blank?
24
+
25
+ Spree.t('i18n.this_file_language', locale: store.default_locale)
26
+ end
27
+
28
+ def should_render_store_chooser?
29
+ Spree::Config.show_store_selector && stores.size > 1
30
+ end
31
+
32
+ def store_link(store = nil, html_opts = {})
33
+ store ||= current_store if defined?(current_store)
34
+ return unless store
35
+
36
+ link_to "#{store_locale_name(store)} (#{store_currency_symbol(store)})", store.formatted_url, **html_opts
37
+ end
38
+ end
39
+ end
@@ -5,7 +5,7 @@ module Spree
5
5
  # to show the most popular products for a particular taxon (that is an exercise left to the developer.)
6
6
  def taxon_preview(taxon, max = 4)
7
7
  ActiveSupport::Deprecation.warn(<<-DEPRECATION, caller)
8
- TaxonsHelper is deprecated and will be removed in Spree 4.2.
8
+ TaxonsHelper is deprecated and will be removed in Spree 5.0.
9
9
  Please remove any `helper 'spree/taxons'` from your controllers.
10
10
  DEPRECATION
11
11
  products = taxon.active_products.distinct.select('spree_products.*, spree_products_taxons.position').limit(max)
@@ -1,7 +1,8 @@
1
1
  module Spree
2
2
  class FrontendConfiguration < Preferences::Configuration
3
3
  preference :coupon_codes_enabled, :boolean, default: true # Determines if we show coupon code form at cart and checkout
4
- preference :locale, :string, default: Rails.application.config.i18n.default_locale
4
+ preference :http_cache_enabled, :boolean, default: true
5
+ preference :locale, :string, default: nil
5
6
  preference :products_filters, :array, default: %w(keywords price sort_by)
6
7
  preference :additional_filters_partials, :array, default: %w()
7
8
  preference :remember_me_enabled, :boolean, default: true
@@ -4,8 +4,8 @@
4
4
  current_page: a page object for the currently displayed page
5
5
  total_pages: total number of pages
6
6
  per_page: number of items to fetch per page
7
- remote: data-remote
8
- -%>
7
+ remote: data-remote -%>
8
+
9
9
  <% unless current_page.first? %>
10
10
  <li class="first page-item">
11
11
  <%= link_to_unless current_page.first?, inline_svg_tag('pagination-double-arrow-right.svg', size: '13px*16px', class: 'spree-icon-arrow-left'), url, remote: remote, class: 'page-link', 'aria-label': 'First page' %>
@@ -3,8 +3,8 @@
3
3
  current_page: a page object for the currently displayed page
4
4
  total_pages: total number of pages
5
5
  per_page: number of items to fetch per page
6
- remote: data-remote
7
- -%>
6
+ remote: data-remote -%>
7
+
8
8
  <li class="page gap disabled page-item d-none d-lg-flex">
9
9
  <a href="#" onclick="return false;" class="page-link">
10
10
  <%= raw(t 'views.pagination.truncate') %>
@@ -4,8 +4,8 @@
4
4
  current_page: a page object for the currently displayed page
5
5
  total_pages: total number of pages
6
6
  per_page: number of items to fetch per page
7
- remote: data-remote
8
- -%>
7
+ remote: data-remote -%>
8
+
9
9
  <% unless current_page.last? %>
10
10
  <li class="last next page-item"><%# "next" class present for border styling in twitter bootstrap %>
11
11
  <%= link_to_unless current_page.last?, inline_svg_tag('pagination-double-arrow-right.svg', size: '13px*16px'), url, remote: remote, class: 'page-link', 'aria-label': 'Last page' %>
@@ -4,8 +4,8 @@
4
4
  current_page: a page object for the currently displayed page
5
5
  total_pages: total number of pages
6
6
  per_page: number of items to fetch per page
7
- remote: data-remote
8
- -%>
7
+ remote: data-remote -%>
8
+
9
9
  <% unless current_page.last? %>
10
10
  <li class="next_page page-item">
11
11
  <%= link_to_unless current_page.last?, inline_svg_tag('pagination-arrow-right.svg', size: '13px*16px'), url, rel: 'next', remote: remote, class: 'page-link', 'aria-label': 'Next page' %>
@@ -5,8 +5,8 @@
5
5
  current_page: a page object for the currently displayed page
6
6
  total_pages: total number of pages
7
7
  per_page: number of items to fetch per page
8
- remote: data-remote
9
- -%>
8
+ remote: data-remote -%>
9
+
10
10
  <li class="page<%= ' active' if page.current? %> page-item">
11
11
  <%= link_to page,
12
12
  url,
@@ -4,8 +4,8 @@
4
4
  total_pages: total number of pages
5
5
  per_page: number of items to fetch per page
6
6
  remote: data-remote
7
- paginator: the paginator that renders the pagination tags inside
8
- -%>
7
+ paginator: the paginator that renders the pagination tags inside -%>
8
+
9
9
  <% pagination_class ||= '' %>
10
10
 
11
11
  <%= paginator.render do %>
@@ -4,8 +4,8 @@
4
4
  current_page: a page object for the currently displayed page
5
5
  total_pages: total number of pages
6
6
  per_page: number of items to fetch per page
7
- remote: data-remote
8
- -%>
7
+ remote: data-remote -%>
8
+
9
9
  <% unless current_page.first? %>
10
10
  <li class="prev page-item">
11
11
  <%= link_to_unless current_page.first?, inline_svg_tag('pagination-arrow-right.svg', size: '13px*16px', class: 'spree-icon-arrow-left'), url, rel: 'prev', remote: remote, class: 'page-link', 'aria-label': 'Previous page' %>
@@ -1,54 +1,54 @@
1
1
  <% address_id = address_type.chars.first %>
2
2
 
3
- <div class="inner" data-hook=<%="#{address_type}_inner" %>>
4
- <div class="form-group" id=<%="#{address_id}firstname" %>>
3
+ <div class="inner" data-hook='<%= "#{address_type}_inner" %>'>
4
+ <div class="form-group" id='<%= "#{address_id}firstname" %>'>
5
5
  <%= form.label :firstname do %>
6
6
  <%= Spree.t(:first_name) %><abbr class="required" title="required">*</abbr>
7
7
  <% end %>
8
8
  <%= form.text_field :firstname, class: 'form-control', required: true %>
9
9
  </div>
10
- <div class="form-group" id=<%="#{address_id}lastname" %>>
10
+ <div class="form-group" id='<%= "#{address_id}lastname" %>'>
11
11
  <%= form.label :lastname do %>
12
12
  <%= Spree.t(:last_name) %><abbr class="required" title="required">*</abbr>
13
13
  <% end %>
14
14
  <%= form.text_field :lastname, class: 'form-control', required: true %>
15
15
  </div>
16
16
  <% if Spree::Config[:company] %>
17
- <div class="form-group" id=<%="#{address_id}company" %>>
17
+ <div class="form-group" id='<%= "#{address_id}company" %>'>
18
18
  <%= form.label :company, Spree.t(:company) %>
19
19
  <%= form.text_field :company, class: 'form-control' %>
20
20
  </div>
21
21
  <% end %>
22
- <div class="form-group" id=<%="#{address_id}address1" %>>
22
+ <div class="form-group" id='<%= "#{address_id}address1" %>'>
23
23
  <%= form.label :address1 do %>
24
24
  <%= Spree.t(:street_address) %><abbr class="required" title="required">*</abbr>
25
25
  <% end %>
26
26
  <%= form.text_field :address1, class: 'form-control required' %>
27
27
  </div>
28
- <div class="form-group" id=<%="#{address_id}address2" %>>
28
+ <div class="form-group" id='<%= "#{address_id}address2" %>'>
29
29
  <%= form.label :address2, Spree.t(:street_address_2) %>
30
30
  <%= form.text_field :address2, class: 'form-control' %>
31
31
  </div>
32
- <div class="form-group" id=<%="#{address_id}city" %>>
32
+ <div class="form-group" id='<%= "#{address_id}city" %>'>
33
33
  <%= form.label :city do %>
34
34
  <%= Spree.t(:city) %><abbr class="required" title="required">*</abbr>
35
35
  <% end %>
36
36
  <%= form.text_field :city, class: 'form-control', required: true %>
37
37
  </div>
38
- <div class="form-group" id=<%="#{address_id}country" %>>
38
+ <div class="form-group" id='<%= "#{address_id}country" %>'>
39
39
  <%= form.label :country_id do %>
40
40
  <%= Spree.t(:country) %><abbr class="required" title="required">*</abbr>
41
41
  <% end %>
42
- <span id=<%="#{address_id}country-selection" %>>
42
+ <span id='<%= "#{address_id}country-selection" %>'>
43
43
  <%= form.collection_select :country_id, available_countries, :id, :name, {}, { class: 'form-control', required: true } %>
44
44
  </span>
45
45
  </div>
46
46
 
47
47
  <% if Spree::Config[:address_requires_state] %>
48
- <div class="form-group" id=<%="#{address_id}state" %>>
48
+ <div class="form-group" id='<%= "#{address_id}state" %>'>
49
49
  <% have_states = !address.country.states.empty? %>
50
50
  <%= form.label :state do %>
51
- <%= Spree.t(:state) %><abbr class='required' title="required" id=<%="#{address_id}state-required"%>>*</abbr>
51
+ <%= Spree.t(:state) %><abbr class='required' title="required" id='<%= "#{address_id}state-required" %>'>*</abbr>
52
52
  <% end %>
53
53
 
54
54
  <%== state_elements = [
@@ -62,28 +62,27 @@
62
62
  class: !have_states ? 'form-control' : 'form-control hidden',
63
63
  required: !have_states,
64
64
  disabled: have_states)
65
- ].join.gsub('"', "'").gsub("\n", "")
66
- %>
65
+ ].join.gsub('"', "'").gsub("\n", "") %>
67
66
  </div>
68
67
  <noscript>
69
68
  <%= form.text_field :state_name, class: 'form-control', required: true %>
70
69
  </noscript>
71
70
  <% end %>
72
71
 
73
- <div class="form-group" id=<%="#{address_id}zipcode" %>>
72
+ <div class="form-group" id='<%= "#{address_id}zipcode" %>'>
74
73
  <%= form.label :zipcode do %>
75
74
  <%= Spree.t(:zip) %><% if address.require_zipcode? %><abbr class="required" title="required">*</abbr><% end %>
76
75
  <% end %>
77
76
  <%= form.text_field :zipcode, class: 'form-control', required: address.require_zipcode? %>
78
77
  </div>
79
- <div class="form-group" id=<%="#{address_id}phone" %>>
78
+ <div class="form-group" id='<%= "#{address_id}phone" %>'>
80
79
  <%= form.label :phone do %>
81
80
  <%= Spree.t(:phone) %><% if address.require_phone? %><abbr class="required" title="required">*</abbr><% end %>
82
81
  <% end %>
83
82
  <%= form.phone_field :phone, class: 'form-control', required: address.require_phone? %>
84
83
  </div>
85
84
  <% if Spree::Config[:alternative_shipping_phone] %>
86
- <div class="form-group" id=<%="#{address_id}altphone" %>>
85
+ <div class="form-group" id='<%= "#{address_id}altphone" %>'>
87
86
  <%= form.label :alternative_phone, Spree.t(:alternative_phone) %>
88
87
  <%= form.phone_field :alternative_phone, class: 'form-control' %>
89
88
  </div>
@@ -6,7 +6,7 @@
6
6
  <div id="<%= "#{address_id}country-selection" %>" class="d-block position-relative has-float-label">
7
7
  <%= address_form.collection_select :country_id, available_countries, :id, :name,
8
8
  { prompt: Spree.t(:country).upcase },
9
- { class: 'required form-control spree-flat-select',
9
+ { class: 'form-control spree-flat-select',
10
10
  aria: { label: Spree.t(:country) } } %>
11
11
  <%= image_tag 'arrow.svg', class: 'position-absolute spree-flat-select-arrow' %>
12
12
  <%= address_form.label(Spree.t(:country), Spree.t(:country).upcase, class:'text-uppercase') %>
@@ -11,8 +11,8 @@
11
11
  address_name: 'address',
12
12
  address_form: f,
13
13
  address_type: 'shipping',
14
- address: @address
15
- %>
14
+ address: @address %>
15
+
16
16
  <%= f.submit Spree.t(:update), class: 'btn btn-primary btn-block spree-btn mb-5' %>
17
17
  <% end %>
18
18
  </div>
@@ -10,8 +10,8 @@
10
10
  address_name: 'address',
11
11
  address_form: f,
12
12
  address_type: 'shipping',
13
- address: @address
14
- %>
13
+ address: @address %>
14
+
15
15
  <%= f.submit t(:save, scope: :address_book), class: 'btn btn-primary btn-block spree-btn mb-5' %>
16
16
  <% end %>
17
17
  </div>