spree_frontend 4.2.0.rc2 → 4.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spree/frontend.js +38 -5
  3. data/app/assets/javascripts/spree/frontend/account.js +1 -1
  4. data/app/assets/javascripts/spree/frontend/cart.js +1 -1
  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 +1 -1
  8. data/app/assets/javascripts/spree/frontend/currency.js +43 -0
  9. data/app/assets/javascripts/spree/frontend/locale.js +13 -0
  10. data/app/assets/javascripts/spree/frontend/views/spree/products/cart_form.js +1 -1
  11. data/app/assets/stylesheets/spree/frontend/application.scss +0 -3
  12. data/app/assets/stylesheets/spree/frontend/functions.scss +1 -0
  13. data/app/assets/stylesheets/spree/frontend/variables/bootstrap-overrides.scss +2 -2
  14. data/app/assets/stylesheets/spree/frontend/variables/helper-variables.scss +1 -0
  15. data/app/assets/stylesheets/spree/frontend/variables/variables.scss +54 -0
  16. data/app/assets/stylesheets/spree/frontend/views/spree/checkout/confirm.scss +27 -22
  17. data/app/assets/stylesheets/spree/frontend/views/spree/orders/show.scss +3 -0
  18. data/app/controllers/concerns/spree/locale_urls.rb +21 -0
  19. data/app/controllers/spree/checkout_controller.rb +8 -8
  20. data/app/controllers/spree/currency_controller.rb +9 -9
  21. data/app/controllers/spree/home_controller.rb +5 -1
  22. data/app/controllers/spree/locale_controller.rb +23 -6
  23. data/app/controllers/spree/orders_controller.rb +2 -2
  24. data/app/controllers/spree/products_controller.rb +6 -5
  25. data/app/controllers/spree/store_controller.rb +7 -13
  26. data/app/controllers/spree/taxons_controller.rb +4 -3
  27. data/app/helpers/spree/addresses_helper.rb +19 -8
  28. data/app/helpers/spree/cache_helper.rb +7 -0
  29. data/app/helpers/spree/frontend_helper.rb +15 -23
  30. data/app/helpers/spree/navigation_helper.rb +6 -1
  31. data/app/helpers/spree/store_helper.rb +39 -0
  32. data/app/helpers/spree/taxons_helper.rb +1 -1
  33. data/app/models/spree/frontend_configuration.rb +2 -1
  34. data/app/views/kaminari/twitter-bootstrap-4/_first_page.html.erb +2 -2
  35. data/app/views/kaminari/twitter-bootstrap-4/_gap.html.erb +2 -2
  36. data/app/views/kaminari/twitter-bootstrap-4/_last_page.html.erb +2 -2
  37. data/app/views/kaminari/twitter-bootstrap-4/_next_page.html.erb +2 -2
  38. data/app/views/kaminari/twitter-bootstrap-4/_page.html.erb +2 -2
  39. data/app/views/kaminari/twitter-bootstrap-4/_paginator.html.erb +2 -2
  40. data/app/views/kaminari/twitter-bootstrap-4/_prev_page.html.erb +2 -2
  41. data/app/views/spree/address/_form.html.erb +15 -16
  42. data/app/views/spree/addresses/_form.html.erb +1 -1
  43. data/app/views/spree/addresses/edit.html.erb +2 -2
  44. data/app/views/spree/addresses/new.html.erb +2 -2
  45. data/app/views/spree/checkout/_address.html.erb +4 -6
  46. data/app/views/spree/checkout/_confirm.html.erb +1 -33
  47. data/app/views/spree/checkout/_credit_card.html.erb +2 -2
  48. data/app/views/spree/checkout/_delivery_informations.html.erb +43 -36
  49. data/app/views/spree/checkout/_summary.html.erb +3 -5
  50. data/app/views/spree/checkout/payment/_gateway.html.erb +1 -1
  51. data/app/views/spree/home/index.html.erb +21 -22
  52. data/app/views/spree/locale/index.html.erb +1 -0
  53. data/app/views/spree/orders/_coupon_code.html.erb +2 -3
  54. data/app/views/spree/orders/_line_item.html.erb +2 -2
  55. data/app/views/spree/orders/_line_item_data.html.erb +1 -1
  56. data/app/views/spree/orders/edit.html.erb +2 -3
  57. data/app/views/spree/orders/show.html.erb +1 -71
  58. data/app/views/spree/products/_cart_form.html.erb +4 -7
  59. data/app/views/spree/products/_color_option_type.html.erb +2 -3
  60. data/app/views/spree/products/_filters_desktop.html.erb +1 -2
  61. data/app/views/spree/products/_gallery.html.erb +4 -6
  62. data/app/views/spree/products/_gallery_modal.html.erb +3 -5
  63. data/app/views/spree/products/_option_type.html.erb +1 -2
  64. data/app/views/spree/products/_sort_mobile.html.erb +4 -4
  65. data/app/views/spree/products/related.html.erb +11 -5
  66. data/app/views/spree/products/show.html.erb +1 -2
  67. data/app/views/spree/shared/_carousel_4_products.html.erb +6 -12
  68. data/app/views/spree/shared/_color_select.html.erb +3 -3
  69. data/app/views/spree/shared/_currency_dropdown.html.erb +13 -0
  70. data/app/views/spree/shared/_delete_address_popup.html.erb +1 -2
  71. data/app/views/spree/shared/_error_messages.html.erb +2 -2
  72. data/app/views/spree/shared/_footer.html.erb +4 -4
  73. data/app/views/spree/shared/_head.html.erb +2 -1
  74. data/app/views/spree/shared/_header.html.erb +1 -1
  75. data/app/views/spree/shared/_internationalization_options.html.erb +31 -0
  76. data/app/views/spree/shared/_line_item.html.erb +2 -2
  77. data/app/views/spree/shared/_link_to_account.html.erb +5 -5
  78. data/app/views/spree/shared/_locale_and_currency.html.erb +6 -0
  79. data/app/views/spree/shared/_locale_dropdown.html.erb +13 -0
  80. data/app/views/spree/shared/_login.html.erb +1 -1
  81. data/app/views/spree/shared/_main_nav_bar.html.erb +1 -1
  82. data/app/views/spree/shared/_mobile_internationalization_options.html.erb +37 -0
  83. data/app/views/spree/shared/_mobile_navigation.html.erb +3 -6
  84. data/app/views/spree/shared/_nav_bar.html.erb +5 -5
  85. data/app/views/spree/shared/_no_product_available.html.erb +1 -1
  86. data/app/views/spree/shared/_option_values.html.erb +1 -1
  87. data/app/views/spree/shared/_order_details.html.erb +117 -174
  88. data/app/views/spree/shared/_payment.html.erb +2 -2
  89. data/app/views/spree/shared/_payment_sources.html.erb +2 -2
  90. data/app/views/spree/shared/_product_added_modal.html.erb +1 -1
  91. data/app/views/spree/shared/_search.html.erb +1 -2
  92. data/app/views/spree/shared/_translations.html.erb +6 -6
  93. data/app/views/spree/shared/carousel/_single.html.erb +6 -11
  94. data/app/views/spree/shared/carousel/_thumbnails.html.erb +5 -11
  95. data/app/views/spree/users/_address.html.erb +1 -1
  96. data/app/views/spree/users/_address_controls.html.erb +1 -2
  97. data/app/views/spree/users/show.html.erb +4 -4
  98. data/config/initializers/canonical_rails.rb +1 -1
  99. data/config/routes.rb +26 -30
  100. data/lib/generators/spree/frontend/copy_storefront/copy_storefront_generator.rb +1 -7
  101. data/lib/generators/spree/frontend/install/install_generator.rb +34 -0
  102. data/lib/generators/spree/frontend/install/templates/config/initializers/spree_storefront.rb +1 -0
  103. data/lib/generators/spree/frontend/install/templates/config/spree_storefront.yml +99 -0
  104. data/spree_frontend.gemspec +2 -2
  105. metadata +29 -19
  106. data/app/views/spree/shared/_change_store.html.erb +0 -25
  107. data/app/views/spree/shared/_mobile_change_store.html.erb +0 -30
  108. data/app/views/spree/shared/forbidden.html.erb +0 -0
  109. data/app/views/spree/shared/unauthorized.html.erb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38163d04925f22790f12bdbbeb77beac79cdbd366c6ea04e065009b2fd9b82d1
4
- data.tar.gz: b53af71727410e46e99acbbf972e13580fb3c41977508e41125c6b5718c8bfc4
3
+ metadata.gz: eb44ce8a344e6b78adcb87064ed90e0ec7f3f02cfc474dda6d16d41e1077e733
4
+ data.tar.gz: 7febb328e551e0396decabb7e357c626c39ab573d71895dc6e55d115bb9d6e7c
5
5
  SHA512:
6
- metadata.gz: b8b342aa804b56453c2c7bc447cf52d664f097c16b04de44e5d0bd3c153314e9450806b167b3372b2483ebcd5ab312eac3c868ee6b852b03106aaa094e69794f
7
- data.tar.gz: 2c2d42c10cbbd8e2dedd374693255c9c24044c84dcf2a3e641fe0aa57cadfe3552134139af193c35cd78b4f9ba2749072803d78bfc67775a8c6a4ecddccf1f58
6
+ metadata.gz: cd5453aa3218dbbedadfc27b7f3958b33560f0d8ec33d03aee58b1d22b3c255c6cded27469e2a1b6194fb73fd0e5c658545aeb90e6003dbc6355694457ec46be
7
+ data.tar.gz: 67815113708206d6f6bab183804c7005d8ccaa707005ff6392d38eebd4b9462951833d8507da6617011a6e4052c208c67bc3be49039f25c5b5cad9e3077b9c31
@@ -15,6 +15,8 @@
15
15
  //= require spree/frontend/api_tokens
16
16
  //= require spree/frontend/carousel-noconflict
17
17
  //= require spree/frontend/cart
18
+ //= require spree/frontend/locale
19
+ //= require spree/frontend/currency
18
20
  //= require spree/frontend/checkout
19
21
  //= require spree/frontend/checkout/address
20
22
  //= require spree/frontend/checkout/address_book
@@ -42,8 +44,39 @@
42
44
 
43
45
  Spree.routes.api_tokens = Spree.pathFor('api_tokens')
44
46
  Spree.routes.ensure_cart = Spree.pathFor('ensure_cart')
45
- Spree.routes.api_v2_storefront_cart_apply_coupon_code = Spree.pathFor('api/v2/storefront/cart/apply_coupon_code')
46
- Spree.routes.api_v2_storefront_cart_remove_coupon_code = Spree.pathFor('api/v2/storefront/cart/remove_coupon_code')
47
- Spree.routes.product = function(id) { return Spree.pathFor('products/' + id) }
48
- Spree.routes.product_related = function(id) { return Spree.pathFor('products/' + id + '/related') }
49
- Spree.routes.product_carousel = function (taxonId) { return Spree.pathFor('product_carousel/' + taxonId) }
47
+ Spree.routes.api_v2_storefront_cart_apply_coupon_code = Spree.localizedPathFor('api/v2/storefront/cart/apply_coupon_code')
48
+ Spree.routes.api_v2_storefront_cart_remove_coupon_code = function(couponCode) { return Spree.localizedPathFor('api/v2/storefront/cart/remove_coupon_code/' + couponCode) }
49
+ Spree.routes.product = function(id) { return Spree.localizedPathFor('products/' + id) }
50
+ Spree.routes.product_related = function(id) { return Spree.localizedPathFor('products/' + id + '/related') }
51
+ Spree.routes.product_carousel = function (taxonId) { return Spree.localizedPathFor('product_carousel/' + taxonId) }
52
+ Spree.routes.set_locale = function(locale) { return Spree.pathFor('locale/set?switch_to_locale=' + locale) }
53
+ Spree.routes.set_currency = function(currency) { return Spree.pathFor('currency/set?switch_to_currency=' + currency) }
54
+
55
+ Spree.showProgressBar = function () {
56
+ if (!Turbolinks.supported) { return }
57
+ Turbolinks.controller.adapter.progressBar.setValue(0)
58
+ Turbolinks.controller.adapter.progressBar.show()
59
+ }
60
+
61
+ Spree.clearCache = function () {
62
+ if (!Turbolinks.supported) { return }
63
+
64
+ Turbolinks.clearCache()
65
+ }
66
+
67
+ Spree.setCurrency = function (currency) {
68
+ Spree.clearCache()
69
+
70
+ var params = (new URL(window.location)).searchParams
71
+ if (currency === SPREE_DEFAULT_CURRENCY) {
72
+ params.delete('currency')
73
+ } else {
74
+ params.set('currency', currency)
75
+ }
76
+ var queryString = params.toString()
77
+ if (queryString !== '') { queryString = '?' + queryString }
78
+
79
+ SPREE_CURRENCY = currency
80
+
81
+ Turbolinks.visit(window.location.pathname + queryString, { action: 'replace' })
82
+ }
@@ -1,6 +1,6 @@
1
1
  Spree.fetchAccount = function () {
2
2
  return $.ajax({
3
- url: Spree.pathFor('account_link')
3
+ url: Spree.localizedPathFor('account_link')
4
4
  }).done(function (data) {
5
5
  Spree.accountFetched = true
6
6
  return $('#link-to-account').html(data)
@@ -123,7 +123,7 @@ Spree.ready(function ($) {
123
123
 
124
124
  Spree.fetchCart = function () {
125
125
  return $.ajax({
126
- url: Spree.pathFor('cart_link')
126
+ url: Spree.localizedPathFor('cart_link')
127
127
  }).done(function (data) {
128
128
  Spree.cartFetched = true
129
129
  return $('#link-to-cart').html(data)
@@ -1,16 +1,24 @@
1
- Spree.ready(function ($) {
2
- Spree.onAddress = function () {
1
+ Spree.ready(function($) {
2
+ Spree.onAddress = function() {
3
3
  if ($('#checkout_form_address').length) {
4
- Spree.updateState = function (region) {
4
+ Spree.updateState = function(region) {
5
5
  var countryId = getCountryId(region)
6
6
  if (countryId != null) {
7
7
  if (Spree.Checkout[countryId] == null) {
8
8
  $.ajax({
9
- async: false, method: 'GET', url: Spree.pathFor('/api/v2/storefront/countries/' + countryId + '?include=states'), dataType: 'json'
10
- }).done(function (data) {
11
- var json = data.included; var xStates = []
9
+ async: false,
10
+ method: 'GET',
11
+ url: Spree.localizedPathFor('/api/v2/storefront/countries/' + countryId + '?include=checkout_zone_applicable_states'),
12
+ dataType: 'json'
13
+ }).done(function(data) {
14
+ var json = data.included;
15
+ var xStates = [];
12
16
  for (var i = 0; i < json.length; i++) {
13
- var obj = json[i]; xStates.push({ 'id': obj.id, 'name': obj.attributes.name })
17
+ var obj = json[i];
18
+ xStates.push({
19
+ id: obj.id,
20
+ name: obj.attributes.name
21
+ })
14
22
  }
15
23
  Spree.Checkout[countryId] = {
16
24
  states: xStates,
@@ -27,7 +35,7 @@ Spree.ready(function ($) {
27
35
  }
28
36
  }
29
37
 
30
- Spree.toggleZipcode = function (data, region) {
38
+ Spree.toggleZipcode = function(data, region) {
31
39
  var requiredIndicator = $('span#required_marker').first().text()
32
40
  var zipcodeRequired = data.zipcode_required
33
41
  var zipcodePara = $('#' + region + 'zipcode')
@@ -49,7 +57,7 @@ Spree.ready(function ($) {
49
57
  }
50
58
  }
51
59
 
52
- Spree.fillStates = function (data, region) {
60
+ Spree.fillStates = function(data, region) {
53
61
  var selected
54
62
  var statesRequired = data.states_required
55
63
  var states = data.states
@@ -63,64 +71,72 @@ Spree.ready(function ($) {
63
71
  if (states.length > 0) {
64
72
  selected = parseInt(stateSelect.val())
65
73
  stateSelect.html('')
66
- $.each(states, function (idx, state) {
74
+ $.each(states, function(idx, state) {
67
75
  var opt = $(document.createElement('option')).attr('value', state.id).html(state.name)
68
76
  if (selected.toString(10) === state.id.toString(10)) {
69
77
  opt.prop('selected', true)
70
78
  }
71
79
  stateSelect.append(opt)
72
80
  })
73
- stateSelect.prop('required', false)
74
- stateSelect.prop('disabled', false).show()
75
- stateLabel.addClass('state-select-label')
76
- stateInput.hide().prop('disabled', true)
77
- statePara.show()
78
- stateSpanRequired.hide()
79
- stateSelect.removeClass('required')
81
+ // If States are listed for the Country selected kill the input field
82
+ stateInput.hide()
83
+ .prop('disabled', true)
84
+ .prop('required', false)
85
+ .val('')
80
86
 
81
- if (statesRequired) {
82
- stateSelect.addClass('required')
83
- stateSelectImg.show()
84
- stateSpanRequired.show()
85
- stateSelect.prop('required', true)
86
- }
87
- stateSelect.removeClass('hidden')
88
- stateInput.removeClass('required')
87
+ // Activate the State select dropdown.
88
+ statePara.show()
89
+ stateSelect.prop('required', statesRequired)
90
+ .prop('disabled', false)
91
+ .show()
92
+ stateSelectImg.show()
93
+ stateLabel.addClass('state-select-label')
94
+ stateSpanRequired.toggle(statesRequired)
89
95
  } else {
90
- stateSelect.hide().prop('disabled', true)
91
- stateLabel.removeClass('state-select-label')
96
+ // If no States are listed in the database for the country selected
97
+ // and a State is not required => (United Kingdom).
98
+ // Kill the State selector and input field.
92
99
  stateSelectImg.hide()
93
- stateInput.show()
100
+ stateSelect.hide()
101
+ .prop('disabled', true)
102
+ .prop('required', false)
103
+ .find('option').remove()
104
+
105
+ stateInput.prop('disabled', true)
106
+ .prop('required', false)
107
+ .hide()
108
+
109
+ // Toggle visibility of States parent element based on State required.
110
+ statePara.toggle(statesRequired)
111
+
94
112
  if (statesRequired) {
113
+ // If a State is required, but none are listed in the database
114
+ // for the country selected => (Hong Kong)
115
+ // Enable the State input field, set it to required.
116
+ stateInput.show()
117
+ .prop('disabled', false)
118
+ .prop('required', true)
95
119
  stateSpanRequired.show()
96
- stateLabel.removeClass('state-select-label')
97
- stateInput.addClass('required form-control')
98
- } else {
99
- stateInput.val('')
100
- stateSpanRequired.hide()
101
- stateInput.removeClass('required')
120
+ stateLabel.removeClass('state-select-label') // required for floating label
102
121
  }
103
- statePara.toggle(!!statesRequired)
104
- stateInput.prop('disabled', !statesRequired)
105
- stateInput.removeClass('hidden')
106
- stateSelect.removeClass('required')
107
122
  }
108
123
  }
109
- $('#bcountry select').change(function () {
124
+ $('#bcountry select').change(function() {
110
125
  Spree.updateState('b')
111
126
  })
112
- $('#scountry select').change(function () {
127
+ $('#scountry select').change(function() {
113
128
  Spree.updateState('s')
114
129
  })
115
130
  Spree.updateState('b')
116
131
 
117
132
  var orderUseBilling = $('input#order_use_billing')
118
- orderUseBilling.change(function () {
133
+ orderUseBilling.change(function() {
119
134
  updateShippingFormState(orderUseBilling)
120
135
  })
121
136
  updateShippingFormState(orderUseBilling)
122
137
  }
123
- function updateShippingFormState (orderUseBilling) {
138
+
139
+ function updateShippingFormState(orderUseBilling) {
124
140
  if (orderUseBilling.is(':checked')) {
125
141
  $('#shipping .inner').hide()
126
142
  $('#shipping .inner input, #shipping .inner select').prop('disabled', true)
@@ -130,7 +146,8 @@ Spree.ready(function ($) {
130
146
  Spree.updateState('s')
131
147
  }
132
148
  }
133
- function getCountryId (region) {
149
+
150
+ function getCountryId(region) {
134
151
  return $('#' + region + 'country select').val()
135
152
  }
136
153
  }
@@ -3,6 +3,7 @@ function ShippingTotalManager (input1) {
3
3
  this.input = input1
4
4
  this.shippingMethods = this.input.shippingMethods
5
5
  this.shipmentTotal = this.input.shipmentTotal
6
+ this.isFreeShipping = this.input.isFreeShipping
6
7
  this.taxTotal = this.input.taxTotal
7
8
  this.nonShipmentTax = $(this.taxTotal).data('non-shipment-tax')
8
9
  this.orderTotal = this.input.orderTotal
@@ -35,8 +36,19 @@ ShippingTotalManager.prototype.parseCurrencyToFloat = function (input) {
35
36
  return accounting.unformat(input, this.formatOptions.decimal)
36
37
  }
37
38
 
39
+ ShippingTotalManager.prototype.totalShipmentAmount = function (newShipmentTotal, oldShipmentTotal) {
40
+ var totalShipmentAmount = 0;
41
+ if (!this.isFreeShipping.html()) {
42
+ totalShipmentAmount = newShipmentTotal - oldShipmentTotal
43
+
44
+ return totalShipmentAmount
45
+ } else {
46
+ return totalShipmentAmount
47
+ }
48
+ }
49
+
38
50
  ShippingTotalManager.prototype.readjustSummarySection = function (orderTotal, newShipmentTotal, oldShipmentTotal, newTaxTotal, oldTaxTotal) {
39
- var newOrderTotal = orderTotal + (newShipmentTotal - oldShipmentTotal) + (newTaxTotal - oldTaxTotal)
51
+ var newOrderTotal = orderTotal + this.totalShipmentAmount(newShipmentTotal, oldShipmentTotal) + (newTaxTotal - oldTaxTotal)
40
52
  this.taxTotal.html(accounting.formatMoney(newTaxTotal, this.formatOptions))
41
53
  this.shipmentTotal.html(accounting.formatMoney(newShipmentTotal, this.formatOptions))
42
54
  return this.orderTotal.html(accounting.formatMoney(accounting.toFixed(newOrderTotal, 10), this.formatOptions))
@@ -53,7 +65,8 @@ Spree.ready(function ($) {
53
65
  orderTotal: $('#summary-order-total'),
54
66
  taxTotal: $('[data-hook="tax-total"]'),
55
67
  shipmentTotal: $('[data-hook="shipping-total"]'),
56
- shippingMethods: $('input[data-behavior="shipping-method-selector"]')
68
+ shippingMethods: $('input[data-behavior="shipping-method-selector"]'),
69
+ isFreeShipping: $('[data-hook="is-free-shipping"]')
57
70
  }
58
71
  return new ShippingTotalManager(input).bindEvent()
59
72
  })
@@ -74,7 +74,7 @@ CouponManager.prototype.sendRemoveRequest = function () {
74
74
  return $.ajax({
75
75
  async: false,
76
76
  method: 'DELETE',
77
- url: Spree.routes.api_v2_storefront_cart_remove_coupon_code + '/' + this.couponCode,
77
+ url: Spree.routes.api_v2_storefront_cart_remove_coupon_code(this.couponCode),
78
78
  dataType: 'json',
79
79
  headers: {
80
80
  'X-Spree-Order-Token': SpreeAPI.orderToken
@@ -0,0 +1,43 @@
1
+ document.addEventListener('turbolinks:load', function(event) {
2
+ // this condition checks if this is the first initial load of turbolinks application
3
+ if (!event.data.timing.visitStart) {
4
+ var currencySelect = document.querySelectorAll('select[name=switch_to_currency]')
5
+
6
+ if (currencySelect.length) {
7
+ currencySelect.forEach(function (element) {
8
+ element.addEventListener('change', function () {
9
+ Spree.showProgressBar()
10
+ var newCurrency = this.value
11
+
12
+ // we need to make AJAX call here to the backend to set currency in session
13
+ fetch(Spree.routes.set_currency(newCurrency), {
14
+ method: 'GET'
15
+ }).then(function (response) {
16
+ switch (response.status) {
17
+ case 200:
18
+ Spree.setCurrency(newCurrency)
19
+ document.getElementById('internationalization-options-desktop').classList.remove('show')
20
+ break
21
+ }
22
+ })
23
+ })
24
+ })
25
+ }
26
+ }
27
+ })
28
+
29
+ // fix back button issue with different currency set
30
+ // invalidate page if cached page has different currency then the current one
31
+ document.addEventListener('turbolinks:load', function(event) {
32
+ if (SPREE_CURRENCY === SPREE_DEFAULT_CURRENCY) {
33
+ var regexAnyCurrency = new RegExp('currency=')
34
+ if (event.data.url.match(regexAnyCurrency) && !event.data.url.match(SPREE_CURRENCY)) {
35
+ Spree.setCurrency(SPREE_CURRENCY)
36
+ }
37
+ } else {
38
+ var regex = new RegExp('currency=' + SPREE_CURRENCY)
39
+ if (!event.data.url.match(regex)) {
40
+ Spree.setCurrency(SPREE_CURRENCY)
41
+ }
42
+ }
43
+ })
@@ -0,0 +1,13 @@
1
+ document.addEventListener('turbolinks:load', function () {
2
+ var localeSelect = document.querySelectorAll('select[name=switch_to_locale]')
3
+
4
+ if (localeSelect.length) {
5
+ localeSelect.forEach(function (element) {
6
+ element.addEventListener('change', function () {
7
+ Spree.clearCache()
8
+ Spree.showProgressBar()
9
+ this.form.submit()
10
+ })
11
+ })
12
+ }
13
+ })
@@ -255,7 +255,7 @@ function CartForm($, $cartForm) {
255
255
 
256
256
  this.$price.html(variant.display_price)
257
257
 
258
- var compareAtPriceContent = shouldDisplayCompareAtPrice ? '<span class="mr-3">' + variant.display_compare_at_price + '</span>' : ''
258
+ var compareAtPriceContent = shouldDisplayCompareAtPrice ? variant.display_compare_at_price : ''
259
259
  this.$compareAtPrice.html(compareAtPriceContent)
260
260
  }
261
261
 
@@ -1,6 +1,4 @@
1
1
  @import "spree/frontend/variables/variables";
2
- @import "spree/frontend/variables/bootstrap-overrides";
3
- @import "spree/frontend/variables/helper-variables";
4
2
  @import "bootstrap";
5
3
  @import "spree/frontend/bootstrap-patches";
6
4
 
@@ -32,7 +30,6 @@
32
30
  @import "spree/frontend/views/spree/errors/not_found";
33
31
  @import "spree/frontend/views/spree/shared/carousel/thumbnails";
34
32
  @import "spree/frontend/views/spree/shared/carousel/single";
35
- @import "spree/frontend/views/spree/shared/change_store";
36
33
  @import "spree/frontend/views/spree/home/index";
37
34
  @import "spree/frontend/views/spree/user_passwords/user_passwords";
38
35
  @import "spree/frontend/views/spree/user_sessions/new";
@@ -1,4 +1,5 @@
1
1
  $font-size-base-px: 16px; //assuming 16px is 1rem ($font-size-base: 1rem in Bootstrap 4)
2
+ $x1: null;
2
3
 
3
4
  @function font-px-to-rem($target-font-size-px: $font-size-base-px) {
4
5
  @return $font-size-base * ( $target-font-size-px / $font-size-base-px );
@@ -1,3 +1,4 @@
1
+ // we're keeping this file for legacy installations relying on it
1
2
  $grid-gutter-width: 19px;
2
3
  $body-color: $font-color;
3
4
  $theme-colors: (
@@ -35,6 +36,5 @@ $grid-breakpoints: (
35
36
  $container-max-widths: (
36
37
  sm: 768px,
37
38
  md: 992px,
38
- lg: 1200px,
39
- xl: 1200px
39
+ lg: 1200px
40
40
  );
@@ -1,3 +1,4 @@
1
+ // we're keeping this file for legacy installations relying on it
1
2
  $container-padding: 17px;
2
3
  $photo-width-to-height-ratio: 30001/ 37500;
3
4
  $photo-width-to-height-ratio-zoom: 28015 / 37500;
@@ -1,3 +1,4 @@
1
+ // main spree variables
1
2
  $primary-color: #0074c2;
2
3
  $secondary-color: #4c4c4c;
3
4
  $primary-background: #ffffff;
@@ -18,3 +19,56 @@ $spree-header-max-width: 1440px;
18
19
  $spree-header-mobile-height: 50px;
19
20
  $spree-header-tablet-height: 75px;
20
21
  $spree-header-desktop-height: 75px;
22
+
23
+ // bootstrap overrides
24
+ $grid-gutter-width: 19px;
25
+ $body-color: $font-color;
26
+ $theme-colors: (
27
+ // standard bootstrap colors
28
+ "primary": $primary-color,
29
+ "secondary": $secondary-color,
30
+ "danger": #f53737,
31
+ "info": #999999,
32
+ "warning": #ffc107,
33
+ "light-secondary": #999999,
34
+ "borders": $second-global-border,
35
+ "dark-borders": $global-border-style,
36
+ "light-background": $primary-background,
37
+ "dark-text": $font-color,
38
+ "overlay": rgba(76, 76, 76, 0.5),
39
+ "shadow": rgba(0, 0, 0, 0.16)
40
+ );
41
+ $enable-rounded: false;
42
+ $enable-shadows: false;
43
+ $enable-gradients: false;
44
+ $font-family-sans-serif: $font-family;
45
+ $font-weight-medium: 500;
46
+ .font-weight-medium {
47
+ font-weight: $font-weight-medium;
48
+ }
49
+ $btn-border-width: 2px;
50
+ $modal-dialog-margin: 0;
51
+ $grid-breakpoints: (
52
+ xs: 0,
53
+ sm: 576px,
54
+ md: 768px,
55
+ lg: 992px,
56
+ xl: 1200px
57
+ );
58
+ $container-max-widths: (
59
+ sm: 768px,
60
+ md: 992px,
61
+ lg: 1200px
62
+ );
63
+
64
+ // helper variables
65
+ $container-padding: 17px;
66
+ $photo-width-to-height-ratio: 30001/ 37500;
67
+ $photo-width-to-height-ratio-zoom: 28015 / 37500;
68
+ $thumbnails-carousel-single-height: 100% / $photo-width-to-height-ratio;
69
+ $thumbnails-carousel-single-height-zoom: 100% /
70
+ $photo-width-to-height-ratio-zoom;
71
+ $zoom-height-breakpoint: calc(
72
+ 650px / #{$photo-width-to-height-ratio-zoom} + 102px * 2
73
+ );
74
+ $spree-plp-filter-desktop-position: $spree-header-desktop-height + 77px;