spree_core 5.0.5 → 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/base_helper.rb +1 -6
- data/app/helpers/spree/images_helper.rb +12 -13
- data/app/helpers/spree/integrations_helper.rb +15 -0
- data/app/helpers/spree/mail_helper.rb +3 -4
- 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/credit_card.rb +24 -2
- 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/option_value.rb +2 -2
- data/app/models/spree/order.rb +16 -5
- data/app/models/spree/order_merger.rb +7 -5
- data/app/models/spree/page_sections/featured_posts.rb +0 -4
- data/app/models/spree/payment.rb +1 -2
- data/app/models/spree/payment_source.rb +0 -21
- data/app/models/spree/post.rb +0 -1
- 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_handler.rb +1 -0
- data/app/models/spree/shipping_method.rb +2 -2
- data/app/models/spree/store.rb +9 -4
- data/app/models/spree/store_credit_category.rb +4 -0
- data/app/models/spree/taxon.rb +4 -7
- data/app/models/spree/theme.rb +1 -1
- data/app/models/spree/wishlist.rb +0 -7
- data/app/services/spree/country_to_timezone.rb +273 -0
- data/app/services/spree/products/prepare_nested_attributes.rb +2 -9
- 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/app/views/spree/shared/_payment.html.erb +0 -9
- data/config/locales/en.yml +48 -20
- 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 +15 -14
- data/lib/spree/core/controller_helpers/currency.rb +11 -0
- data/lib/spree/core/controller_helpers/strong_parameters.rb +3 -2
- data/lib/spree/core/engine.rb +13 -3
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/core.rb +1 -0
- data/lib/spree/permitted_attributes.rb +111 -13
- 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/page_section_factory.rb +0 -4
- data/lib/spree/testing_support/factories/payment_factory.rb +0 -5
- data/lib/spree/testing_support/factories/payment_method_factory.rb +0 -5
- data/lib/spree/testing_support/factories/promotion_action_factory.rb +4 -0
- 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 -7
- data/app/models/concerns/spree/payment_source_concern.rb +0 -39
- data/app/models/spree/gateway/custom_payment_source_method.rb +0 -33
- data/lib/spree/testing_support/factories/payment_source_factory.rb +0 -5
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
|
@@ -716,7 +738,6 @@ en:
|
|
716
738
|
capture: Capture
|
717
739
|
capture_events: Capture events
|
718
740
|
card_code: Card Verification Code (CVC)
|
719
|
-
card_expiration_placeholder: MM/YYYY
|
720
741
|
card_number: Card Number
|
721
742
|
card_type: Brand
|
722
743
|
card_type_is: Card type is
|
@@ -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
|
@@ -892,8 +913,6 @@ en:
|
|
892
913
|
destroy: Destroy
|
893
914
|
details: Details
|
894
915
|
developers: Developers
|
895
|
-
didn_t_receive_confirmation_instructions: Didn't receive confirmation instructions?
|
896
|
-
didn_t_receive_unlock_instructions: Didn't receive unlock instructions?
|
897
916
|
digital:
|
898
917
|
digital_delivery: Digital Delivery
|
899
918
|
digital_assets: Digital assets
|
@@ -1125,6 +1144,7 @@ en:
|
|
1125
1144
|
internationalization: Internationalization
|
1126
1145
|
invalid_credit_card: Invalid credit card.
|
1127
1146
|
invalid_exchange_variant: Invalid exchange variant.
|
1147
|
+
invalid_or_expired_invitation: Invalid or expired invitation
|
1128
1148
|
invalid_payment_provider: Invalid payment provider.
|
1129
1149
|
invalid_promotion_action: Invalid promotion action.
|
1130
1150
|
invalid_promotion_rule: Invalid promotion rule.
|
@@ -1132,6 +1152,20 @@ en:
|
|
1132
1152
|
inventory_adjustment: Inventory Adjustment
|
1133
1153
|
inventory_error_flash_for_insufficient_quantity: An item in your cart has become unavailable.
|
1134
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
|
1135
1169
|
is_not_available_to_shipment_address: is not available to shipment address
|
1136
1170
|
iso: ISO Alpha-2
|
1137
1171
|
iso3: ISO Alpha-3
|
@@ -1167,7 +1201,6 @@ en:
|
|
1167
1201
|
list: List
|
1168
1202
|
live: Live
|
1169
1203
|
loading: Loading
|
1170
|
-
loading_tree: Loading tree. Please wait…
|
1171
1204
|
locale_changed: Locale Changed
|
1172
1205
|
location: Location
|
1173
1206
|
lock: Lock
|
@@ -1182,7 +1215,6 @@ en:
|
|
1182
1215
|
login_failed: Login authentication failed.
|
1183
1216
|
login_name: Login
|
1184
1217
|
logo: Logo
|
1185
|
-
logo_alt: Brand logo
|
1186
1218
|
logout: Logout
|
1187
1219
|
logs: Logs
|
1188
1220
|
look_for_similar_items: Look for similar items
|
@@ -1211,9 +1243,6 @@ en:
|
|
1211
1243
|
metadata: Metadata
|
1212
1244
|
min: Min
|
1213
1245
|
minimal_amount: Minimal Amount
|
1214
|
-
minimum_password_length:
|
1215
|
-
one: "(%{count} character minimum)"
|
1216
|
-
other: "(%{count} characters minimum)"
|
1217
1246
|
missing_return_authorization: Missing Return Authorization for %{item_name}.
|
1218
1247
|
month: Month
|
1219
1248
|
more: More
|
@@ -1239,7 +1268,7 @@ en:
|
|
1239
1268
|
new_billing_address: New Billing Address
|
1240
1269
|
new_country: New Country
|
1241
1270
|
new_custom_domain: New Custom Domain
|
1242
|
-
new_customer:
|
1271
|
+
new_customer: New Customer
|
1243
1272
|
new_customer_return: New Customer Return
|
1244
1273
|
new_digital_asset: New digital asset
|
1245
1274
|
new_domain: New domain
|
@@ -1468,7 +1497,6 @@ en:
|
|
1468
1497
|
video:
|
1469
1498
|
heading_1_default: Why I recommend it?
|
1470
1499
|
heading_2_default: There's nothing like a soft hint of blush to add dimension and color to your look.
|
1471
|
-
page_settings: Page settings
|
1472
1500
|
pages: Pages
|
1473
1501
|
pages_defaults:
|
1474
1502
|
homepage:
|
@@ -1487,7 +1515,7 @@ en:
|
|
1487
1515
|
password_protected: Password protected
|
1488
1516
|
paste: Paste
|
1489
1517
|
path: Path
|
1490
|
-
pay:
|
1518
|
+
pay: pay
|
1491
1519
|
payment: Payment
|
1492
1520
|
payment_amount: Payment amount
|
1493
1521
|
payment_attempts: failed attempts
|
@@ -1504,11 +1532,11 @@ en:
|
|
1504
1532
|
payment_source: Payment source
|
1505
1533
|
payment_state: Payment State
|
1506
1534
|
payment_states:
|
1507
|
-
balance_due: Balance
|
1535
|
+
balance_due: Balance due
|
1508
1536
|
checkout: Checkout
|
1509
1537
|
complete: Complete
|
1510
1538
|
completed: Completed
|
1511
|
-
credit_owed: Credit
|
1539
|
+
credit_owed: Credit owed
|
1512
1540
|
failed: Failed
|
1513
1541
|
paid: Paid
|
1514
1542
|
partially_refunded: Partially Refunded
|
@@ -1526,12 +1554,15 @@ en:
|
|
1526
1554
|
percent: Percent
|
1527
1555
|
percent_per_item: Percent Per Item
|
1528
1556
|
permalink: Permalink
|
1557
|
+
permissions: Permissions
|
1529
1558
|
personal_details: Personal details
|
1530
1559
|
phone: Phone
|
1531
1560
|
place_order: Place Order
|
1532
1561
|
please_check_back_soon: Please check back soon.
|
1533
1562
|
please_define_payment_methods: Please define some payment methods first.
|
1534
1563
|
please_enter_reasonable_quantity: Please enter a reasonable quantity.
|
1564
|
+
please_select: Please select
|
1565
|
+
please_select_all_options: Please select all options
|
1535
1566
|
policies: Policies
|
1536
1567
|
populate_get_error: Something went wrong. Please try adding the item again.
|
1537
1568
|
post_categories: Post categories
|
@@ -1882,7 +1913,6 @@ en:
|
|
1882
1913
|
show_store_selector:
|
1883
1914
|
long: Display the Store selector in the main nav bar of Storefront and allow users to change Store and Currency
|
1884
1915
|
short: Show Store selector
|
1885
|
-
sign_in_with_provider: Sign in with %{provider}
|
1886
1916
|
sign_out: Sign out
|
1887
1917
|
sign_up: Sign Up
|
1888
1918
|
site_name: Site name
|
@@ -2103,7 +2133,6 @@ en:
|
|
2103
2133
|
timezone: Timezone
|
2104
2134
|
title: Title
|
2105
2135
|
title_link: Title link
|
2106
|
-
to: To
|
2107
2136
|
to_add_variants_you_must_first_define: To add variants, you must first define
|
2108
2137
|
toggle_menu: Toggle menu
|
2109
2138
|
top_suggestions: Top suggestions
|
@@ -2149,7 +2178,6 @@ en:
|
|
2149
2178
|
update_billing_address: Update billing address
|
2150
2179
|
update_contact_information: Update contact information
|
2151
2180
|
update_shipping_address: Update shipping address
|
2152
|
-
updated: Updated
|
2153
2181
|
updated_at: Updated at
|
2154
2182
|
updating: Updating
|
2155
2183
|
upload_image: Upload image
|
@@ -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,12 +17,12 @@ 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
|
@@ -44,18 +44,19 @@ module Spree
|
|
44
44
|
@current_oauth_token ||= get_last_access_token.call(user) || create_access_token.call(user)
|
45
45
|
end
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
authentication_routes.each do |route|
|
52
|
-
disallowed_urls << send(route) if respond_to?(route)
|
53
|
-
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
|
54
51
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
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"
|
59
60
|
end
|
60
61
|
|
61
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
|
|
@@ -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
|
@@ -96,7 +98,6 @@ module Spree
|
|
96
98
|
Rails.application.config.spree.payment_methods = [
|
97
99
|
Spree::Gateway::Bogus,
|
98
100
|
Spree::Gateway::BogusSimple,
|
99
|
-
Spree::Gateway::CustomPaymentSourceMethod,
|
100
101
|
Spree::PaymentMethod::Check,
|
101
102
|
Spree::PaymentMethod::StoreCredit
|
102
103
|
]
|
@@ -235,6 +236,13 @@ module Spree
|
|
235
236
|
Spree::Reports::SalesTotal
|
236
237
|
]
|
237
238
|
|
239
|
+
Rails.application.config.spree.translatable_resources = [
|
240
|
+
Spree::Product,
|
241
|
+
Spree::Taxon,
|
242
|
+
Spree::Taxonomy,
|
243
|
+
Spree::Store
|
244
|
+
]
|
245
|
+
|
238
246
|
Rails.application.config.spree.analytics_events = {
|
239
247
|
product_viewed: 'Product Viewed',
|
240
248
|
product_list_viewed: 'Product List Viewed',
|
@@ -258,9 +266,11 @@ module Spree
|
|
258
266
|
checkout_email_entered: 'Checkout Email Entered',
|
259
267
|
checkout_step_viewed: 'Checkout Step Viewed',
|
260
268
|
checkout_step_completed: 'Checkout Step Completed',
|
261
|
-
order_completed: 'Order Completed'
|
269
|
+
order_completed: 'Order Completed',
|
262
270
|
}
|
263
271
|
Rails.application.config.spree.analytics_event_handlers = []
|
272
|
+
|
273
|
+
Rails.application.config.spree.integrations = []
|
264
274
|
end
|
265
275
|
|
266
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.
|