spree_backend 4.8.0 → 4.8.2

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: 3300d2767c8c33fab939d5c7c30dd41db56d9c422469820f8eaeef2bcf71ba6e
4
- data.tar.gz: 745fb617eed98c7268c185eddc32eab136e6067624b712fbd85f9c777b520bbe
3
+ metadata.gz: 1fcf46360a990310f18e30818626389d5a0ccb1e0d91bcd470616dacb58ce6b4
4
+ data.tar.gz: 2280d31a00c62784a613e6d4b0a1be265b5cb87298ef9aca924d4a844dddcb39
5
5
  SHA512:
6
- metadata.gz: e291674023a82d06681356deeffcfe747da3450e835f6fbbd7ca81be1782bc54be59471a9bf1040ea2ee0b685a30f7a2a2e20cda76d1c6a7b5c8b1016f797f0c
7
- data.tar.gz: 27ca5a00563290b6523fa8ff3bcc73f00c8e4a250c319942e15f556c129021603f0555003603ac68f93e196b04cbb45b8dfb11f1ed619d5f3b814cc3c0edaaf7
6
+ metadata.gz: 4fe9f868e598c4e5762a9508377d619a8bbbd24162dabe14c834b4da642e94a96fd481d2254727bdc77bf8a3321cf2ddb165c1e496402c4e85430f26890aa8fd
7
+ data.tar.gz: c8efa862bf95922a2c17fa68d1719662e2e7515702ad4fb0a8432991e8148c1038ee764e0280e109204a99324bfa736a04a6cc06daf1e70392970f8c950c0d53
@@ -20,13 +20,26 @@ module Spree
20
20
  locales_to_update = current_store_locales & params_locales
21
21
 
22
22
  locales_to_update.each do |locale|
23
- translation = @object.translations.find_or_initialize_by(locale: locale)
24
- translation_params.each do |attribute, translations|
25
- translation.public_send("#{attribute}=", translations[locale])
23
+ if update_translation_value?(locale)
24
+ translation = @object.translations.find_or_initialize_by(locale: locale)
25
+ translation_params.each do |attribute, translations|
26
+ translation.public_send("#{attribute}=", translations[locale])
27
+ end
28
+ translation.save!
29
+ else
30
+ Mobility.with_locale(locale) do
31
+ translation_params.each do |attribute, translations|
32
+ @object.public_send("#{attribute}=", translations[locale])
33
+ end
34
+ @object.save!
35
+ end
26
36
  end
27
- translation.save!
28
37
  end
29
38
  end
39
+
40
+ def update_translation_value?(locale)
41
+ Spree.always_use_translations? || I18n.default_locale.to_s != locale
42
+ end
30
43
  end
31
44
  end
32
45
  end
@@ -85,9 +85,11 @@ module Spree
85
85
  build,
86
86
  ItemBuilder.new('properties', admin_properties_path).
87
87
  with_admin_ability_check(Spree::Property).
88
+ with_match_path('/properties').
88
89
  build,
89
90
  ItemBuilder.new('prototypes', admin_prototypes_path).
90
91
  with_admin_ability_check(Spree::Prototype).
92
+ with_match_path('/prototypes').
91
93
  build,
92
94
  ItemBuilder.new('taxonomies', admin_taxonomies_path).
93
95
  with_admin_ability_check(Spree::Taxonomy).
@@ -110,9 +112,11 @@ module Spree
110
112
  items = [
111
113
  ItemBuilder.new('stock_transfers', admin_stock_transfers_path).
112
114
  with_manage_ability_check(Spree::StockTransfer).
115
+ with_match_path('/stock_transfers').
113
116
  build,
114
117
  ItemBuilder.new('stock_locations', admin_stock_locations_path).
115
118
  with_manage_ability_check(Spree::StockLocation).
119
+ with_match_path('/stock_locations').
116
120
  build
117
121
  ]
118
122
 
@@ -133,10 +137,14 @@ module Spree
133
137
 
134
138
  def add_promotions_section(root)
135
139
  items = [
136
- ItemBuilder.new('promotions', admin_promotions_path).build,
140
+ ItemBuilder.new('promotions', admin_promotions_path).
141
+ with_admin_ability_check(Spree::Promotion).
142
+ with_match_path('/promotions').
143
+ build,
137
144
  ItemBuilder.new('promotion_categories', admin_promotion_categories_path).
138
145
  with_admin_ability_check(Spree::PromotionCategory).
139
146
  with_label_translation_key('admin.tab.promotion_categories').
147
+ with_match_path('/promotion_categories').
140
148
  build
141
149
  ]
142
150
 
@@ -217,35 +225,53 @@ module Spree
217
225
  # rubocop:disable Metrics/AbcSize
218
226
  def add_settings_section(root)
219
227
  items = [
220
- ItemBuilder.new('store', ->(store) { edit_admin_store_path(store) }).build,
228
+ ItemBuilder.new('store', ->(store) { edit_admin_store_path(store) }).
229
+ with_match_path(/\/admin\/stores\//).
230
+ build,
221
231
  ItemBuilder.new('tax_categories', admin_tax_categories_path).
232
+ with_match_path('/tax_categories').
222
233
  with_manage_ability_check(Spree::TaxCategory).
223
234
  build,
224
- ItemBuilder.new('tax_rates', admin_tax_rates_path).with_manage_ability_check(Spree::TaxRate).build,
225
- ItemBuilder.new('zones', admin_zones_path).with_manage_ability_check(Spree::Zone).build,
226
- ItemBuilder.new('country', admin_countries_path).with_manage_ability_check(Spree::Country).build,
235
+ ItemBuilder.new('tax_rates', admin_tax_rates_path).with_manage_ability_check(Spree::TaxRate).
236
+ with_match_path('/tax_rates').
237
+ build,
238
+ ItemBuilder.new('zones', admin_zones_path).with_manage_ability_check(Spree::Zone).
239
+ with_match_path('/zones').
240
+ build,
241
+ ItemBuilder.new('country', admin_countries_path).with_manage_ability_check(Spree::Country).
242
+ with_match_path(%r{^/admin/countries$}).
243
+ build,
227
244
  ItemBuilder.new('states', ->(store) { admin_country_states_path(store.default_country) }).
245
+ with_match_path(/states/).
228
246
  with_manage_ability_check(->(ability, store) { store.default_country && ability.can?(:manage, Spree::Country) }).
229
247
  build,
230
248
  ItemBuilder.new('shipping_methods', admin_shipping_methods_path).
249
+ with_match_path('/shipping_methods').
231
250
  with_manage_ability_check(Spree::ShippingMethod).
232
251
  build,
233
252
  ItemBuilder.new('shipping_categories', admin_shipping_categories_path).
253
+ with_match_path('/shipping_categories').
234
254
  with_manage_ability_check(Spree::ShippingCategory).
235
255
  build,
236
256
  ItemBuilder.new('store_credit_categories', admin_store_credit_categories_path).
257
+ with_match_path('/store_credit_categories').
237
258
  with_manage_ability_check(Spree::StoreCreditCategory).
238
259
  build,
239
260
  ItemBuilder.new('refund_reasons', admin_refund_reasons_path).
261
+ with_match_path('/refund_reasons').
240
262
  with_manage_ability_check(Spree::RefundReason).
241
263
  build,
242
264
  ItemBuilder.new('reimbursement_types', admin_reimbursement_types_path).
265
+ with_match_path('/reimbursement_types').
243
266
  with_manage_ability_check(Spree::ReimbursementType).
244
267
  build,
245
268
  ItemBuilder.new('return_authorization_reasons', admin_return_authorization_reasons_path).
269
+ with_match_path('/return_authorization_reasons').
246
270
  with_manage_ability_check(Spree::ReturnAuthorizationReason).
247
271
  build,
248
- ItemBuilder.new('roles', admin_roles_path).with_manage_ability_check(Spree::Role).build
272
+ ItemBuilder.new('roles', admin_roles_path).with_manage_ability_check(Spree::Role).
273
+ with_match_path('/roles').
274
+ build
249
275
  ]
250
276
 
251
277
  section = SectionBuilder.new('settings', 'gear-fill.svg').
@@ -1,6 +1,6 @@
1
1
  module Spree
2
2
  module Backend
3
- VERSION = '4.8.0'.freeze
3
+ VERSION = '4.8.2'.freeze
4
4
 
5
5
  def self.version
6
6
  VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_backend
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.8.0
4
+ version: 4.8.2
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: 2024-05-23 00:00:00.000000000 Z
12
+ date: 2024-06-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: spree
@@ -2488,9 +2488,9 @@ licenses:
2488
2488
  - BSD-3-Clause
2489
2489
  metadata:
2490
2490
  bug_tracker_uri: https://github.com/spree/spree_backend/issues
2491
- changelog_uri: https://github.com/spree/spree_backend/releases/tag/v4.8.0
2491
+ changelog_uri: https://github.com/spree/spree_backend/releases/tag/v4.8.2
2492
2492
  documentation_uri: https://docs.spreecommerce.org/
2493
- source_code_uri: https://github.com/spree/spree_backend/tree/v4.8.0
2493
+ source_code_uri: https://github.com/spree/spree_backend/tree/v4.8.2
2494
2494
  post_install_message:
2495
2495
  rdoc_options: []
2496
2496
  require_paths: