spree_core 4.2.0 → 4.2.4
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 +4 -4
- data/app/assets/javascripts/spree.js +11 -8
- data/app/helpers/spree/currency_helper.rb +11 -1
- data/app/models/spree/address.rb +2 -0
- data/app/models/spree/product.rb +11 -2
- data/config/locales/en.yml +1 -1
- data/lib/spree/core/controller_helpers/currency.rb +7 -0
- data/lib/spree/core/version.rb +3 -1
- data/lib/spree/testing_support/locale_helpers.rb +7 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73a956aa0f5f8359d02e3804606a880d73af297547ef3eca07066e7ee244a728
|
4
|
+
data.tar.gz: 55cb848ec873396022bcaa67b8d8f6281ce4dd2d48dd1692e59f72e012c0dd13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0749dcc7a17168458bfa742d9f4df1ad99c2f642fd6a4654be232cc8b75c8f72f73286effb135909a17bbcc27d5bdf7932f75c073068eb1492d4159f23793a66'
|
7
|
+
data.tar.gz: 8ddae63ba67bf3c68492f80605646176bb82bdb2ca1d80ffa3139cafca4402d4156e9f14d15353bff0b7d7fa1f72cd340b4dbf826697ee0b995c64383bfcf5a2
|
@@ -22,16 +22,19 @@ Spree.pathFor = function (path) {
|
|
22
22
|
}
|
23
23
|
|
24
24
|
Spree.localizedPathFor = function(path) {
|
25
|
-
if (typeof (SPREE_LOCALE) !== 'undefined') {
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|
-
|
35
|
+
pathName = (this.mountedAt()) + SPREE_LOCALE + '/' + path
|
34
36
|
}
|
37
|
+
return fullUrl.origin + pathName + '?' + params.toString()
|
35
38
|
}
|
36
39
|
return Spree.pathFor(path)
|
37
40
|
}
|
@@ -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
|
data/app/models/spree/address.rb
CHANGED
@@ -25,6 +25,8 @@ module Spree
|
|
25
25
|
ADDRESS_FIELDS = %w(firstname lastname company address1 address2 city state zipcode country phone)
|
26
26
|
EXCLUDED_KEYS_FOR_COMPARISION = %w(id updated_at created_at deleted_at label user_id)
|
27
27
|
|
28
|
+
scope :not_deleted, -> { where(deleted_at: nil) }
|
29
|
+
|
28
30
|
belongs_to :country, class_name: 'Spree::Country'
|
29
31
|
belongs_to :state, class_name: 'Spree::State', optional: true
|
30
32
|
belongs_to :user, class_name: Spree.user_class.name, optional: true
|
data/app/models/spree/product.rb
CHANGED
@@ -102,8 +102,9 @@ module Spree
|
|
102
102
|
validates :meta_title
|
103
103
|
end
|
104
104
|
with_options presence: true do
|
105
|
-
validates :name
|
106
|
-
validates :
|
105
|
+
validates :name
|
106
|
+
validates :shipping_category, if: :requires_shipping_category?
|
107
|
+
validates :price, if: :requires_price?
|
107
108
|
end
|
108
109
|
|
109
110
|
validates :slug, presence: true, uniqueness: { allow_blank: true, case_sensitive: false }
|
@@ -485,5 +486,13 @@ module Spree
|
|
485
486
|
instance_variable_set(:"@#{v}", nil)
|
486
487
|
end
|
487
488
|
end
|
489
|
+
|
490
|
+
def requires_price?
|
491
|
+
Spree::Config[:require_master_price]
|
492
|
+
end
|
493
|
+
|
494
|
+
def requires_shipping_category?
|
495
|
+
true
|
496
|
+
end
|
488
497
|
end
|
489
498
|
end
|
data/config/locales/en.yml
CHANGED
@@ -1615,7 +1615,7 @@ en:
|
|
1615
1615
|
code_help: "Store unique identifier, which is an abbreviated version of the store’s name (used as the layout directory name, and also helpful for separating templates by store)"
|
1616
1616
|
checkout_zone_help: "Selecting zone will limit to which Countries or States products are shipped.
|
1617
1617
|
For more information <a href='https://guides.spreecommerce.org/user/configuration/configuring_geography.html#zones' target='_blank' class='alert-link'>please see documentation</a>"
|
1618
|
-
locales_help: "Install <a href='https://github.com/spree-contrib/spree_i18n target='_blank' class='alert-link'>Spree I18n extension</a> to add more locales"
|
1618
|
+
locales_help: "Install <a href='https://github.com/spree-contrib/spree_i18n' target='_blank' class='alert-link'>Spree I18n extension</a> to add more locales"
|
1619
1619
|
social_help: "If you want to link to your social accounts in the footer part of your website please fill below fields"
|
1620
1620
|
default_country_help: "This is the Country that will be pre-selected on the Checkout Address form"
|
1621
1621
|
footer_help: "This content is visible in the footer section of your Store"
|
@@ -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
|
data/lib/spree/core/version.rb
CHANGED
@@ -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.
|
4
|
+
version: 4.2.4
|
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-
|
12
|
+
date: 2021-05-17 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.
|
1178
|
+
changelog_uri: https://github.com/spree/spree/releases/tag/v4.2.4
|
1179
1179
|
documentation_uri: https://guides.spreecommerce.org/
|
1180
|
-
source_code_uri: https://github.com/spree/spree/tree/v4.2.
|
1180
|
+
source_code_uri: https://github.com/spree/spree/tree/v4.2.4
|
1181
1181
|
post_install_message:
|
1182
1182
|
rdoc_options: []
|
1183
1183
|
require_paths:
|