spree_core 5.0.2 → 5.1.0.beta
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/images/logo.png +0 -0
- data/app/finders/spree/products/find.rb +28 -1
- data/app/finders/spree/taxons/find.rb +1 -1
- data/app/helpers/spree/integrations_helper.rb +15 -0
- data/app/javascript/spree/core/controllers/disable_submit_button_controller.js +19 -0
- data/app/mailers/spree/invitation_mailer.rb +24 -0
- data/app/models/concerns/spree/integrations_concern.rb +11 -0
- data/app/models/concerns/spree/product_scopes.rb +6 -6
- data/app/models/concerns/spree/translatable_resource.rb +4 -0
- data/app/models/concerns/spree/translatable_resource_scopes.rb +17 -3
- data/app/models/concerns/spree/unique_name.rb +2 -0
- data/app/models/concerns/spree/user_management.rb +33 -0
- data/app/models/concerns/spree/user_methods.rb +19 -0
- data/app/models/concerns/spree/user_roles.rb +43 -17
- data/app/models/spree/ability.rb +8 -6
- data/app/models/spree/asset.rb +1 -6
- data/app/models/spree/base.rb +1 -0
- data/app/models/spree/base_analytics_event_handler.rb +7 -2
- data/app/models/spree/classification.rb +13 -0
- data/app/models/spree/custom_domain.rb +2 -1
- data/app/models/spree/export.rb +1 -1
- data/app/models/spree/integration.rb +63 -0
- data/app/models/spree/invitation.rb +153 -0
- data/app/models/spree/invitations/store.rb +6 -0
- data/app/models/spree/order.rb +17 -1
- data/app/models/spree/order_merger.rb +7 -5
- data/app/models/spree/page_blocks/products/buy_buttons.rb +8 -0
- data/app/models/spree/page_blocks/products/quantity_selector.rb +4 -0
- data/app/models/spree/page_blocks/products/variant_picker.rb +4 -0
- data/app/models/spree/page_sections/featured_product.rb +4 -0
- data/app/models/spree/page_sections/image_banner.rb +12 -0
- data/app/models/spree/page_sections/image_with_text.rb +12 -0
- data/app/models/spree/page_sections/newsletter.rb +1 -1
- data/app/models/spree/page_sections/rich_text.rb +11 -0
- data/app/models/spree/page_sections/video.rb +8 -0
- data/app/models/spree/product.rb +10 -2
- data/app/models/spree/product_property.rb +1 -1
- data/app/models/spree/property.rb +3 -1
- data/app/models/spree/reports/sales_total.rb +5 -1
- data/app/models/spree/role.rb +16 -0
- data/app/models/spree/role_user.rb +32 -1
- data/app/models/spree/shipment.rb +1 -1
- data/app/models/spree/shipment_handler.rb +1 -0
- data/app/models/spree/shipping_method.rb +1 -1
- data/app/models/spree/store.rb +12 -5
- data/app/models/spree/store_credit_category.rb +4 -0
- data/app/models/spree/taxon.rb +4 -3
- data/app/models/spree/theme.rb +37 -4
- data/app/models/spree/variant.rb +9 -1
- data/app/services/spree/country_to_timezone.rb +273 -0
- data/app/services/spree/seeds/admin_user.rb +4 -2
- data/app/services/spree/seeds/all.rb +3 -1
- data/app/services/spree/seeds/digital_delivery.rb +20 -0
- data/app/services/spree/seeds/returns_environment.rb +27 -0
- data/app/services/spree/seeds/tax_categories.rb +12 -0
- data/app/services/spree/stores/settings_defaults_by_country.rb +38 -0
- data/app/services/spree/tags/bulk_add.rb +13 -7
- data/app/views/spree/invitation_mailer/invitation_accepted.html.erb +12 -0
- data/app/views/spree/invitation_mailer/invitation_email.html.erb +21 -0
- data/config/locales/en.yml +48 -10
- data/db/migrate/20230110142344_backfill_friendly_id_slug_locale.rb +3 -1
- data/db/migrate/20250407085228_create_spree_integrations.rb +12 -0
- data/db/migrate/20250410061306_create_spree_invitations.rb +20 -0
- data/db/migrate/20250418174652_add_resource_to_spree_role_users.rb +8 -0
- data/db/migrate/20250508060800_add_selected_locale_to_spree_admin_users.rb +8 -0
- data/db/migrate/20250509143831_add_session_id_to_spree_assets.rb +5 -0
- data/lib/generators/spree/authentication/devise/devise_generator.rb +5 -2
- data/lib/generators/spree/authentication/devise/templates/authentication_helpers.rb.tt +3 -3
- data/lib/generators/spree/install/install_generator.rb +5 -0
- data/lib/spree/core/controller_helpers/auth.rb +16 -14
- data/lib/spree/core/controller_helpers/currency.rb +11 -0
- data/lib/spree/core/controller_helpers/order.rb +2 -1
- data/lib/spree/core/controller_helpers/strong_parameters.rb +3 -2
- data/lib/spree/core/engine.rb +12 -8
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/core.rb +1 -0
- data/lib/spree/permitted_attributes.rb +118 -13
- data/lib/spree/testing_support/capybara_config.rb +1 -1
- data/lib/spree/testing_support/factories/integration_factory.rb +7 -0
- data/lib/spree/testing_support/factories/invitation_factory.rb +6 -0
- data/lib/spree/testing_support/factories/promotion_action_factory.rb +4 -0
- data/lib/spree/testing_support/factories/stock_item_factory.rb +5 -1
- data/lib/spree/testing_support/factories/user_factory.rb +14 -1
- data/lib/spree/translation_migrations.rb +27 -15
- data/lib/tasks/core.rake +8 -0
- metadata +41 -4
data/config/locales/en.yml
CHANGED
@@ -52,6 +52,9 @@ en:
|
|
52
52
|
year: Year
|
53
53
|
spree/inventory_unit:
|
54
54
|
state: State
|
55
|
+
spree/invitation:
|
56
|
+
expires_at: Expires at
|
57
|
+
inviter: Inviter
|
55
58
|
spree/line_item:
|
56
59
|
price: Price
|
57
60
|
quantity: Quantity
|
@@ -194,6 +197,10 @@ en:
|
|
194
197
|
spree/zone:
|
195
198
|
description: Description
|
196
199
|
name: Name
|
200
|
+
user:
|
201
|
+
current_sign_in: Current sign in at
|
202
|
+
last_sign_in: Last sign in at
|
203
|
+
sign_in_count: Sign in count
|
197
204
|
errors:
|
198
205
|
messages:
|
199
206
|
blank: can't be blank
|
@@ -334,6 +341,9 @@ en:
|
|
334
341
|
spree/export:
|
335
342
|
one: Export
|
336
343
|
other: Exports
|
344
|
+
spree/integration:
|
345
|
+
one: Integration
|
346
|
+
other: Integrations
|
337
347
|
spree/inventory_unit:
|
338
348
|
one: Inventory Unit
|
339
349
|
other: Inventory Units
|
@@ -349,6 +359,18 @@ en:
|
|
349
359
|
spree/order:
|
350
360
|
one: Order
|
351
361
|
other: Orders
|
362
|
+
spree/page:
|
363
|
+
one: Page
|
364
|
+
other: Pages
|
365
|
+
spree/page_block:
|
366
|
+
one: Page Block
|
367
|
+
other: Page Blocks
|
368
|
+
spree/page_link:
|
369
|
+
one: Page Link
|
370
|
+
other: Page Links
|
371
|
+
spree/page_section:
|
372
|
+
one: Page Section
|
373
|
+
other: Page Sections
|
352
374
|
spree/payment:
|
353
375
|
one: Payment
|
354
376
|
other: Payments
|
@@ -526,7 +548,6 @@ en:
|
|
526
548
|
accepts_email_marketing: Accepts email marketing
|
527
549
|
account: Account
|
528
550
|
account_info: Account info
|
529
|
-
account_members: Team
|
530
551
|
action: Action
|
531
552
|
actions:
|
532
553
|
approve: Approve
|
@@ -546,6 +567,7 @@ en:
|
|
546
567
|
receive: Mark as received
|
547
568
|
refund: Refund
|
548
569
|
reject: Reject
|
570
|
+
resend: Resend
|
549
571
|
resolve: Mark as resolved
|
550
572
|
save: Save
|
551
573
|
select_file: Select file
|
@@ -769,7 +791,6 @@ en:
|
|
769
791
|
compare_at_amount: Compare at amount
|
770
792
|
compare_at_price: Compare at price
|
771
793
|
complete: complete
|
772
|
-
conditions: Conditions
|
773
794
|
configuration: Configuration
|
774
795
|
configurations: Configurations
|
775
796
|
confirm: Confirm
|
@@ -785,6 +806,7 @@ en:
|
|
785
806
|
continue_as_guest: Continue as a guest
|
786
807
|
continue_selling_when_out_of_stock: Continue selling when out of stock
|
787
808
|
continue_shopping: Continue shopping
|
809
|
+
continue_without_logging_in: Continue without logging in
|
788
810
|
copy: Copy
|
789
811
|
copy_id: Copy ID
|
790
812
|
copy_link: Copy link
|
@@ -820,14 +842,13 @@ en:
|
|
820
842
|
coupon_codes: Coupon codes
|
821
843
|
create: Create
|
822
844
|
create_a_new_account: Create a new account
|
823
|
-
create_account: Create account
|
824
845
|
create_customer: Create customer
|
825
846
|
create_new: Create new
|
826
847
|
create_new_order: Create new order
|
827
848
|
create_new_team: Create new team
|
828
849
|
create_reimbursement: Create reimbursement
|
829
|
-
created_at: Created
|
830
|
-
created_by: Created
|
850
|
+
created_at: Created at
|
851
|
+
created_by: Created by
|
831
852
|
credit: Credit
|
832
853
|
credit_allowed: Credit allowed
|
833
854
|
credit_card: Credit Card
|
@@ -1123,6 +1144,7 @@ en:
|
|
1123
1144
|
internationalization: Internationalization
|
1124
1145
|
invalid_credit_card: Invalid credit card.
|
1125
1146
|
invalid_exchange_variant: Invalid exchange variant.
|
1147
|
+
invalid_or_expired_invitation: Invalid or expired invitation
|
1126
1148
|
invalid_payment_provider: Invalid payment provider.
|
1127
1149
|
invalid_promotion_action: Invalid promotion action.
|
1128
1150
|
invalid_promotion_rule: Invalid promotion rule.
|
@@ -1130,6 +1152,20 @@ en:
|
|
1130
1152
|
inventory_adjustment: Inventory Adjustment
|
1131
1153
|
inventory_error_flash_for_insufficient_quantity: An item in your cart has become unavailable.
|
1132
1154
|
inventory_state: Inventory State
|
1155
|
+
invitation_accepted: Invitation accepted!
|
1156
|
+
invitation_mailer:
|
1157
|
+
greeting: Hi %{user_name},
|
1158
|
+
invitation_accepted:
|
1159
|
+
body: "%{invitee_name} has accepted your invitation to join %{resource_name}"
|
1160
|
+
subject: "%{invitee_name} has accepted your invitation to join %{resource_name}"
|
1161
|
+
invitation_email:
|
1162
|
+
body: "%{inviter_name} has invited you to join %{resource_name}"
|
1163
|
+
link_description: 'To accept this invitation, please click the link below:'
|
1164
|
+
subject: Invitation to join %{resource_name}
|
1165
|
+
thanks: Thank you,
|
1166
|
+
invitation_resent: Invitation resent!
|
1167
|
+
invitations: Invitations
|
1168
|
+
invited_by: Invited by
|
1133
1169
|
is_not_available_to_shipment_address: is not available to shipment address
|
1134
1170
|
iso: ISO Alpha-2
|
1135
1171
|
iso3: ISO Alpha-3
|
@@ -1165,7 +1201,6 @@ en:
|
|
1165
1201
|
list: List
|
1166
1202
|
live: Live
|
1167
1203
|
loading: Loading
|
1168
|
-
loading_tree: Loading tree. Please wait…
|
1169
1204
|
locale_changed: Locale Changed
|
1170
1205
|
location: Location
|
1171
1206
|
lock: Lock
|
@@ -1180,7 +1215,6 @@ en:
|
|
1180
1215
|
login_failed: Login authentication failed.
|
1181
1216
|
login_name: Login
|
1182
1217
|
logo: Logo
|
1183
|
-
logo_alt: Brand logo
|
1184
1218
|
logout: Logout
|
1185
1219
|
logs: Logs
|
1186
1220
|
look_for_similar_items: Look for similar items
|
@@ -1234,7 +1268,7 @@ en:
|
|
1234
1268
|
new_billing_address: New Billing Address
|
1235
1269
|
new_country: New Country
|
1236
1270
|
new_custom_domain: New Custom Domain
|
1237
|
-
new_customer:
|
1271
|
+
new_customer: New Customer
|
1238
1272
|
new_customer_return: New Customer Return
|
1239
1273
|
new_digital_asset: New digital asset
|
1240
1274
|
new_domain: New domain
|
@@ -1430,6 +1464,9 @@ en:
|
|
1430
1464
|
newsletter_form:
|
1431
1465
|
button_text_default: Submit
|
1432
1466
|
placeholder_default: Enter your email
|
1467
|
+
products:
|
1468
|
+
buy_buttons:
|
1469
|
+
display_name: Add To Cart
|
1433
1470
|
page_not_found: Sorry! Page you are looking can’t be found.
|
1434
1471
|
page_sections:
|
1435
1472
|
announcement_bar:
|
@@ -1460,7 +1497,6 @@ en:
|
|
1460
1497
|
video:
|
1461
1498
|
heading_1_default: Why I recommend it?
|
1462
1499
|
heading_2_default: There's nothing like a soft hint of blush to add dimension and color to your look.
|
1463
|
-
page_settings: Page settings
|
1464
1500
|
pages: Pages
|
1465
1501
|
pages_defaults:
|
1466
1502
|
homepage:
|
@@ -1518,6 +1554,7 @@ en:
|
|
1518
1554
|
percent: Percent
|
1519
1555
|
percent_per_item: Percent Per Item
|
1520
1556
|
permalink: Permalink
|
1557
|
+
permissions: Permissions
|
1521
1558
|
personal_details: Personal details
|
1522
1559
|
phone: Phone
|
1523
1560
|
place_order: Place Order
|
@@ -2120,6 +2157,7 @@ en:
|
|
2120
2157
|
translations_for: "%{resource_name} translations"
|
2121
2158
|
tree: Tree
|
2122
2159
|
true_label: 'TRUE'
|
2160
|
+
try_removing_filters: Try removing some filters to see more products
|
2123
2161
|
twitter: Twitter
|
2124
2162
|
type: Type
|
2125
2163
|
type_to_search: Type to search
|
@@ -2140,7 +2178,7 @@ en:
|
|
2140
2178
|
update_billing_address: Update billing address
|
2141
2179
|
update_contact_information: Update contact information
|
2142
2180
|
update_shipping_address: Update shipping address
|
2143
|
-
|
2181
|
+
updated_at: Updated at
|
2144
2182
|
updating: Updating
|
2145
2183
|
upload_image: Upload image
|
2146
2184
|
url: URL
|
@@ -1,6 +1,8 @@
|
|
1
1
|
class BackfillFriendlyIdSlugLocale < ActiveRecord::Migration[6.1]
|
2
2
|
def up
|
3
|
-
|
3
|
+
if Spree::Store.default.present? && Spree::Store.default.default_locale.present?
|
4
|
+
FriendlyId::Slug.unscoped.update_all(locale: Spree::Store.default.default_locale)
|
5
|
+
end
|
4
6
|
end
|
5
7
|
|
6
8
|
def down
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateSpreeIntegrations < ActiveRecord::Migration[7.2]
|
2
|
+
def change
|
3
|
+
create_table :spree_integrations, if_not_exists: true do |t|
|
4
|
+
t.references :store, null: false, index: true
|
5
|
+
t.string :type, null: false, index: true
|
6
|
+
t.text :preferences
|
7
|
+
t.boolean :active, default: false, null: false, index: true
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class CreateSpreeInvitations < ActiveRecord::Migration[7.2]
|
2
|
+
def change
|
3
|
+
create_table :spree_invitations do |t|
|
4
|
+
t.string :email, index: true, null: false
|
5
|
+
t.string :token, index: { unique: true }, null: false
|
6
|
+
t.string :status, null: false, index: true
|
7
|
+
|
8
|
+
t.references :resource, polymorphic: true, index: true, null: false # eg. Store, Vendor, Account
|
9
|
+
t.references :inviter, polymorphic: true, index: true, null: false
|
10
|
+
t.references :invitee, polymorphic: true, index: true
|
11
|
+
t.references :role, null: false
|
12
|
+
|
13
|
+
t.datetime :accepted_at
|
14
|
+
t.datetime :expires_at, index: true
|
15
|
+
t.datetime :deleted_at, index: true
|
16
|
+
|
17
|
+
t.timestamps
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class AddResourceToSpreeRoleUsers < ActiveRecord::Migration[7.2]
|
2
|
+
def change
|
3
|
+
add_reference :spree_role_users, :resource, polymorphic: true, null: true
|
4
|
+
add_reference :spree_role_users, :invitation, null: true
|
5
|
+
|
6
|
+
add_index :spree_role_users, [:resource_id, :resource_type, :user_id, :user_type, :role_id], unique: true
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class AddSelectedLocaleToSpreeAdminUsers < ActiveRecord::Migration[7.2]
|
2
|
+
def change
|
3
|
+
if Spree.admin_user_class.present?
|
4
|
+
users_table_name = Spree.admin_user_class.table_name
|
5
|
+
add_column users_table_name, :selected_locale, :string unless column_exists?(users_table_name, :selected_locale)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
@@ -33,6 +33,8 @@ module Spree
|
|
33
33
|
include Spree::UserPaymentSource
|
34
34
|
RUBY
|
35
35
|
end
|
36
|
+
gsub_file user_class_file, "< ApplicationRecord", "< Spree.base_class"
|
37
|
+
|
36
38
|
say "Successfully added Spree user modules into #{user_class_file}"
|
37
39
|
else
|
38
40
|
say "Could not locate user model file at #{user_class_file}. Please add these lines manually:", :red
|
@@ -42,13 +44,14 @@ module Spree
|
|
42
44
|
include Spree::UserMethods
|
43
45
|
include Spree::UserPaymentSource
|
44
46
|
RUBY
|
47
|
+
|
48
|
+
say "Please replace < ApplicationRecord with < Spree.base_class in #{user_class_file}"
|
45
49
|
end
|
46
50
|
|
47
51
|
append_file 'config/initializers/spree.rb' do
|
48
52
|
%Q{
|
49
53
|
if defined?(Devise) && Devise.respond_to?(:parent_controller)
|
50
|
-
Devise.parent_controller = "Spree::
|
51
|
-
Devise.parent_mailer = "Spree::BaseMailer"
|
54
|
+
Devise.parent_controller = "Spree::BaseController"
|
52
55
|
end\n}
|
53
56
|
end
|
54
57
|
end
|
@@ -38,13 +38,13 @@ module Spree
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def spree_admin_login_path(opts = {})
|
41
|
-
|
41
|
+
new_session_path(Spree.admin_user_class.model_name.singular_route_key, opts)
|
42
42
|
end
|
43
43
|
|
44
44
|
def spree_admin_logout_path(opts = {})
|
45
|
-
|
45
|
+
destroy_session_path(Spree.admin_user_class.model_name.singular_route_key, opts)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
ApplicationController.include Spree::AuthenticationHelpers if defined?(ApplicationController)
|
50
|
+
ApplicationController.include Spree::AuthenticationHelpers if defined?(ApplicationController)
|
@@ -78,6 +78,11 @@ module Spree
|
|
78
78
|
def install_storefront
|
79
79
|
if @install_storefront && Spree::Core::Engine.frontend_available?
|
80
80
|
generate 'spree:storefront:install'
|
81
|
+
|
82
|
+
# generate devise controllers if authentication is devise
|
83
|
+
if @authentication == 'devise'
|
84
|
+
generate 'spree:storefront:devise'
|
85
|
+
end
|
81
86
|
end
|
82
87
|
end
|
83
88
|
|
@@ -17,15 +17,16 @@ module Spree
|
|
17
17
|
|
18
18
|
# Needs to be overridden so that we use Spree's Ability rather than anyone else's.
|
19
19
|
def current_ability
|
20
|
-
@current_ability ||= Spree::Dependencies.ability_class.constantize.new(try_spree_current_user)
|
20
|
+
@current_ability ||= Spree::Dependencies.ability_class.constantize.new(try_spree_current_user, { store: current_store })
|
21
21
|
end
|
22
22
|
|
23
23
|
def redirect_back_or_default(default)
|
24
|
-
|
25
|
-
|
24
|
+
Spree::Deprecation.warn('redirect_back_or_default is deprecated and will be removed in Spree 5.2. Please use redirect_back(fallback_location: default) instead.')
|
25
|
+
redirect_back(fallback_location: default)
|
26
26
|
end
|
27
27
|
|
28
28
|
def set_token
|
29
|
+
Spree::Deprecation.warn('set_token is deprecated and will be removed in Spree 5.2. Please use create_token_cookie(token) instead.')
|
29
30
|
cookies.permanent.signed[:token] ||= cookies.signed[:guest_token]
|
30
31
|
cookies.permanent.signed[:token] ||= {
|
31
32
|
value: generate_token,
|
@@ -43,18 +44,19 @@ module Spree
|
|
43
44
|
@current_oauth_token ||= get_last_access_token.call(user) || create_access_token.call(user)
|
44
45
|
end
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
authentication_routes.each do |route|
|
51
|
-
disallowed_urls << send(route) if respond_to?(route)
|
52
|
-
end
|
47
|
+
# this will work for devise out of the box
|
48
|
+
# for other auth systems you will need to override this method
|
49
|
+
def store_location(location = nil)
|
50
|
+
return if try_spree_current_user
|
53
51
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
52
|
+
location ||= request.fullpath
|
53
|
+
session_key = store_location_session_key
|
54
|
+
|
55
|
+
session[session_key] = location
|
56
|
+
end
|
57
|
+
|
58
|
+
def store_location_session_key
|
59
|
+
"#{Spree.user_class.model_name.singular_route_key.to_sym}_return_to"
|
58
60
|
end
|
59
61
|
|
60
62
|
# proxy method to *possible* spree_current_user method
|
@@ -14,6 +14,8 @@ module Spree
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
# Returns the currently selected currency.
|
18
|
+
# @return [String] the currently selected currency, eg. `USD`
|
17
19
|
def current_currency
|
18
20
|
@current_currency ||= if defined?(session) && session.key?(:currency) && supported_currency?(session[:currency])
|
19
21
|
session[:currency]
|
@@ -26,10 +28,14 @@ module Spree
|
|
26
28
|
end&.upcase
|
27
29
|
end
|
28
30
|
|
31
|
+
# Returns the list of supported currencies for the current store.
|
32
|
+
# @return [Array<Money::Currency>] the list of supported currencies
|
29
33
|
def supported_currencies
|
30
34
|
@supported_currencies ||= current_store&.supported_currencies_list
|
31
35
|
end
|
32
36
|
|
37
|
+
# Returns the list of supported currencies for all stores.
|
38
|
+
# @return [Array<String>] the list of supported currencies, eg. `["USD", "EUR"]`
|
33
39
|
def supported_currencies_for_all_stores
|
34
40
|
@supported_currencies_for_all_stores ||= begin
|
35
41
|
(
|
@@ -39,12 +45,17 @@ module Spree
|
|
39
45
|
end
|
40
46
|
end
|
41
47
|
|
48
|
+
# Checks if the given currency is supported.
|
49
|
+
# @param currency_iso_code [String] the ISO code of the currency, eg. `USD`
|
50
|
+
# @return [Boolean] `true` if the currency is supported, `false` otherwise
|
42
51
|
def supported_currency?(currency_iso_code)
|
43
52
|
return false if supported_currencies.nil?
|
44
53
|
|
45
54
|
supported_currencies.map(&:iso_code).include?(currency_iso_code.upcase)
|
46
55
|
end
|
47
56
|
|
57
|
+
# Returns the currency parameter from the request.
|
58
|
+
# @return [String] the currency parameter, eg. `USD`
|
48
59
|
def currency_param
|
49
60
|
return if current_currency == current_store.default_currency
|
50
61
|
|
@@ -118,7 +118,8 @@ module Spree
|
|
118
118
|
value: token,
|
119
119
|
expires: 90.days.from_now,
|
120
120
|
secure: Rails.configuration.force_ssl || Rails.application.config.ssl_options[:secure_cookies],
|
121
|
-
domain: current_store.url_or_custom_domain
|
121
|
+
domain: current_store.url_or_custom_domain,
|
122
|
+
httponly: true
|
122
123
|
}
|
123
124
|
end
|
124
125
|
|
@@ -33,8 +33,9 @@ module Spree
|
|
33
33
|
|
34
34
|
def permitted_product_attributes
|
35
35
|
permitted_attributes.product_attributes + [
|
36
|
-
:
|
37
|
-
|
36
|
+
variants_attributes: permitted_variant_attributes + ['id', :_destroy],
|
37
|
+
master_attributes: permitted_variant_attributes + ['id'],
|
38
|
+
product_properties_attributes: permitted_product_properties_attributes + ['id', :_destroy]
|
38
39
|
]
|
39
40
|
end
|
40
41
|
|
data/lib/spree/core/engine.rb
CHANGED
@@ -21,8 +21,10 @@ module Spree
|
|
21
21
|
:page_sections,
|
22
22
|
:page_blocks,
|
23
23
|
:reports,
|
24
|
+
:translatable_resources,
|
24
25
|
:analytics_events,
|
25
|
-
:analytics_event_handlers
|
26
|
+
:analytics_event_handlers,
|
27
|
+
:integrations)
|
26
28
|
SpreeCalculators = Struct.new(:shipping_methods, :tax_rates, :promotion_actions_create_adjustments, :promotion_actions_create_item_adjustments)
|
27
29
|
PromoEnvironment = Struct.new(:rules, :actions)
|
28
30
|
isolate_namespace Spree
|
@@ -234,6 +236,13 @@ module Spree
|
|
234
236
|
Spree::Reports::SalesTotal
|
235
237
|
]
|
236
238
|
|
239
|
+
Rails.application.config.spree.translatable_resources = [
|
240
|
+
Spree::Product,
|
241
|
+
Spree::Taxon,
|
242
|
+
Spree::Taxonomy,
|
243
|
+
Spree::Store
|
244
|
+
]
|
245
|
+
|
237
246
|
Rails.application.config.spree.analytics_events = {
|
238
247
|
product_viewed: 'Product Viewed',
|
239
248
|
product_list_viewed: 'Product List Viewed',
|
@@ -257,16 +266,11 @@ module Spree
|
|
257
266
|
checkout_email_entered: 'Checkout Email Entered',
|
258
267
|
checkout_step_viewed: 'Checkout Step Viewed',
|
259
268
|
checkout_step_completed: 'Checkout Step Completed',
|
260
|
-
|
261
269
|
order_completed: 'Order Completed',
|
262
|
-
order_cancelled: 'Order Cancelled',
|
263
|
-
order_refunded: 'Order Refunded',
|
264
|
-
package_shipped: 'Package Shipped',
|
265
|
-
order_fulfilled: 'Order Fulfilled',
|
266
|
-
|
267
|
-
gift_card_issued: 'Gift Card Issued'
|
268
270
|
}
|
269
271
|
Rails.application.config.spree.analytics_event_handlers = []
|
272
|
+
|
273
|
+
Rails.application.config.spree.integrations = []
|
270
274
|
end
|
271
275
|
|
272
276
|
initializer 'spree.promo.register.promotions.actions' do |app|
|
data/lib/spree/core/version.rb
CHANGED
data/lib/spree/core.rb
CHANGED
@@ -31,6 +31,7 @@ require 'request_store'
|
|
31
31
|
require 'wannabe_bool'
|
32
32
|
require 'geocoder'
|
33
33
|
require 'oembed'
|
34
|
+
require 'safely_block'
|
34
35
|
|
35
36
|
# This is required because ActiveModel::Validations#invalid? conflicts with the
|
36
37
|
# invalid state of a Payment. In the future this should be removed.
|