spree_core 4.2.0 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a59c1e362e580d2884f8c82e1c15d2cdf057e21b1efc66e1ede10ef4e41883a8
4
- data.tar.gz: cfe5bc95ed8d23c91c0c19dace8fe3d96b015cbcd97af1c38524b73c94797cac
3
+ metadata.gz: 5f9630450c68b8797b744c4f046769f568ebf50366a956fcbad41ede886c8419
4
+ data.tar.gz: 76d0ef19926855683298402e5ff729982be202b4c03fd021e4440ec7dc6d5185
5
5
  SHA512:
6
- metadata.gz: 420dbd7fdd44e2a4fa1d68d4d9e78a2fc42062757fc9470e57277bb7599fc3883b9e01a8052e5d0c34fb784361a5bc2b1b0b8e0e7bd7342860412e09e5799e70
7
- data.tar.gz: 6b45c3c66e49701c0830b59e51ecb1776563abf078fc0728080479799dbbda443b4191c5f3af934cb663cdda6e824564b5891ec805950e87f949f0011b34430c
6
+ metadata.gz: 604ae3a3334b1a70869577cbafa21eafb5c4953f280e6c9ef6b76b51e5b50b7dbe010b66681076019f55745e40448906e0668c9ee0dc4d8912759ae4fd7289b7
7
+ data.tar.gz: 6fb2f4a1d3b55e5974326ff473fa554757a8d5464c41cb2963af4ffef11e8f26250000c020075fa6dc70127a8267d908687490c9f62919d11ec6b18f56a512ed
@@ -22,16 +22,20 @@ Spree.pathFor = function (path) {
22
22
  }
23
23
 
24
24
  Spree.localizedPathFor = function(path) {
25
- if (typeof (SPREE_LOCALE) !== 'undefined') {
26
- if (path.match(/api\/v/)) {
27
- if (path.match(/\?/)) {
28
- path = path + '&locale=' + SPREE_LOCALE
29
- } else {
30
- path = path + '?locale=' + SPREE_LOCALE
31
- }
25
+ if (typeof (SPREE_LOCALE) !== 'undefined' && typeof (SPREE_CURRENCY) !== 'undefined') {
26
+ var fullUrl = new URL(Spree.pathFor(path))
27
+ var params = fullUrl.searchParams
28
+ var pathName = fullUrl.pathname
29
+
30
+ params.set('currency', SPREE_CURRENCY)
31
+
32
+ if (pathName.match(/api\/v/)) {
33
+ params.set('locale', SPREE_LOCALE)
32
34
  } else {
33
- path = SPREE_LOCALE + '/' + path
35
+ pathName = SPREE_LOCALE + '/' + pathName
34
36
  }
37
+
38
+ path = pathName + '?' + params.toString()
35
39
  }
36
40
  return Spree.pathFor(path)
37
41
  }
@@ -12,7 +12,7 @@ module Spree
12
12
  def supported_currency_options
13
13
  return if current_store.nil?
14
14
 
15
- current_store.supported_currencies_list.map(&:iso_code)
15
+ current_store.supported_currencies_list.map(&:iso_code).map { |currency| currency_presentation(currency) }
16
16
  end
17
17
 
18
18
  def should_render_currency_dropdown?
@@ -20,5 +20,15 @@ module Spree
20
20
 
21
21
  current_store.supported_currencies_list.size > 1
22
22
  end
23
+
24
+ def currency_symbol(currency)
25
+ ::Money::Currency.find(currency).symbol
26
+ end
27
+
28
+ def currency_presentation(currency)
29
+ label = [currency_symbol(currency), currency].compact.join(' ')
30
+
31
+ [label, currency]
32
+ end
23
33
  end
24
34
  end
@@ -9,6 +9,7 @@ module Spree
9
9
  helper_method :supported_currencies_for_all_stores
10
10
  helper_method :current_currency
11
11
  helper_method :supported_currency?
12
+ helper_method :currency_param
12
13
  end
13
14
 
14
15
  def current_currency
@@ -41,6 +42,12 @@ module Spree
41
42
 
42
43
  supported_currencies.map(&:iso_code).include?(currency_iso_code.upcase)
43
44
  end
45
+
46
+ def currency_param
47
+ return if current_currency == current_store.default_currency
48
+
49
+ current_currency
50
+ end
44
51
  end
45
52
  end
46
53
  end
@@ -1,5 +1,7 @@
1
1
  module Spree
2
+ VERSION = '4.2.1'.freeze
3
+
2
4
  def self.version
3
- '4.2.0'
5
+ VERSION
4
6
  end
5
7
  end
@@ -55,11 +55,18 @@ module Spree
55
55
 
56
56
  def open_i18n_menu
57
57
  find('#header #internationalization-button-desktop').click
58
+ expect(page).to have_selector('#internationalization-options-desktop')
59
+ end
60
+
61
+ def close_i18n_menu
62
+ find('#header #internationalization-button-desktop').click
63
+ expect(page).not_to have_selector('#internationalization-options-desktop')
58
64
  end
59
65
 
60
66
  def switch_to_currency(currency)
61
67
  open_i18n_menu
62
68
  select currency, from: 'switch_to_currency'
69
+ expect(page).to have_no_css '.turbolinks-progress-bar'
63
70
  end
64
71
 
65
72
  def switch_to_locale(locale)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0
4
+ version: 4.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-02-25 00:00:00.000000000 Z
12
+ date: 2021-03-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemerchant
@@ -1175,9 +1175,9 @@ licenses:
1175
1175
  - BSD-3-Clause
1176
1176
  metadata:
1177
1177
  bug_tracker_uri: https://github.com/spree/spree/issues
1178
- changelog_uri: https://github.com/spree/spree/releases/tag/v4.2.0
1178
+ changelog_uri: https://github.com/spree/spree/releases/tag/v4.2.1
1179
1179
  documentation_uri: https://guides.spreecommerce.org/
1180
- source_code_uri: https://github.com/spree/spree/tree/v4.2.0
1180
+ source_code_uri: https://github.com/spree/spree/tree/v4.2.1
1181
1181
  post_install_message:
1182
1182
  rdoc_options: []
1183
1183
  require_paths:
@@ -1193,7 +1193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1193
1193
  - !ruby/object:Gem::Version
1194
1194
  version: 1.8.23
1195
1195
  requirements: []
1196
- rubygems_version: 3.1.4
1196
+ rubygems_version: 3.2.3
1197
1197
  signing_key:
1198
1198
  specification_version: 4
1199
1199
  summary: The bare bones necessary for Spree.