alchemy-solidus 7.3.2 → 7.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (24) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/Rakefile +2 -2
  4. data/app/assets/javascripts/alchemy/solidus/admin.js +0 -3
  5. data/app/decorators/models/alchemy/solidus/spree_product_decorator.rb +29 -0
  6. data/app/decorators/models/alchemy/solidus/spree_taxon_decorator.rb +14 -0
  7. data/app/decorators/models/alchemy/solidus/spree_variant_decorator.rb +14 -0
  8. data/app/javascript/alchemy_solidus/components/product_select.js +2 -0
  9. data/app/{assets/javascripts/alchemy/solidus/admin → javascript/alchemy_solidus}/product_select.js +5 -5
  10. data/app/{assets/javascripts/alchemy/solidus/admin → javascript/alchemy_solidus}/select2_config.js +2 -5
  11. data/app/javascript/alchemy_solidus/taxon_select.js +37 -0
  12. data/app/{assets/javascripts/alchemy/solidus/admin → javascript/alchemy_solidus}/variant_select.js +4 -4
  13. data/app/models/alchemy/solidus/touch_alchemy_ingredients.rb +20 -0
  14. data/app/views/alchemy/ingredients/_spree_product_editor.html.erb +3 -1
  15. data/app/views/alchemy/ingredients/_spree_taxon_editor.html.erb +3 -1
  16. data/app/views/alchemy/ingredients/_spree_variant_editor.html.erb +3 -1
  17. data/config/initializers/alchemy.rb +0 -5
  18. data/lib/alchemy/solidus/version.rb +1 -1
  19. metadata +13 -16
  20. data/app/assets/javascripts/alchemy/solidus/admin/taxon_select.js +0 -32
  21. data/app/decorators/models/spree/spree_product_decorator.rb +0 -27
  22. data/app/decorators/models/spree/spree_taxon_decorator.rb +0 -12
  23. data/app/decorators/models/spree/spree_variant_decorator.rb +0 -12
  24. data/app/models/alchemy_solidus/touch_alchemy_ingredients.rb +0 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e1182b12b2857cdeccf70d46d97155050830a92816754f5992d99441ff0b92f0
4
- data.tar.gz: 6f1a5626551ac48979ab6f50458ed302dc2195d1e7e29db37daab95b90edebc0
3
+ metadata.gz: 82a16927c6d7992aa7fcd560ff0dc0256247db5b7d0ae0bf6a5b75479bd0f211
4
+ data.tar.gz: 0a616ca40b010d4020150075ae8b9c3dff90daee943ada553b506ded102b6a49
5
5
  SHA512:
6
- metadata.gz: 7c6c6cfe0857555870618beb4deb66491c7c168cb3c66f870b1120c1110631cd7583fb8d661a7420daa074ff42f17e3c4b0fc613dabca5a40afe284622e24fe7
7
- data.tar.gz: c5ecac53e8b876e2ad839fda98e478d55693f403576ca5f42f93e7eca0fb51c2da58f03b339bc355884f29f6bdc35036786ebb59c89f26ef8d120117fe3c9ec1
6
+ metadata.gz: a3d3b2fdafe77314f34d302d6489dd1eeba5d2e2eef0b430d0aab04bb8408e4a2fdeee568541d2c40e2b9f94c8fd7d613b1c86ee9a4bfd9c14190348de30adc9
7
+ data.tar.gz: 06a7fe63b8a6a5d5e25a7aab985d9aa40d6c2c7413c1d600dcc8e2d411ac2b31c2d1af90bef5d27dc46ec91b22a056a1e404bc4d71805b31c53183bc0ef7726d
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![CI](https://github.com/AlchemyCMS/alchemy-solidus/workflows/CI/badge.svg?branch=main)](https://github.com/AlchemyCMS/alchemy-solidus/actions?query=workflow%3ACI+branch%3Amain)
1
+ [![CI](https://github.com/AlchemyCMS/alchemy-solidus/actions/workflows/ci.yml/badge.svg)](https://github.com/AlchemyCMS/alchemy-solidus/actions/workflows/ci.yml)
2
2
  [![Gem Version](https://badge.fury.io/rb/alchemy-solidus.svg)](https://badge.fury.io/rb/alchemy-solidus)
3
3
 
4
4
  # Sponsoring
data/Rakefile CHANGED
@@ -14,9 +14,9 @@ task default: %i[test_setup spec]
14
14
 
15
15
  desc "Setup test app"
16
16
  task :test_setup do
17
- solidus_version = ENV.fetch("SOLIDUS_VERSION", "4.3")
17
+ solidus_branch = ENV.fetch("SOLIDUS_BRANCH", "v4.4")
18
18
  solidus_install_options = "--payment-method=none --frontend=none --authentication=none"
19
- if solidus_version >= "4.3"
19
+ if ["v4.3", "v4.4", "main"].include?(solidus_branch)
20
20
  solidus_install_options += " --admin-preview=false"
21
21
  end
22
22
  Dir.chdir("spec/dummy") do
@@ -1,4 +1 @@
1
- //= require alchemy/solidus/admin/product_select
2
- //= require alchemy/solidus/admin/variant_select
3
- //= require alchemy/solidus/admin/taxon_select
4
1
  //= require spree
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Alchemy
4
+ module Solidus
5
+ module SpreeProductDecorator
6
+ def self.prepended(base)
7
+ base.include Alchemy::Solidus::TouchAlchemyIngredients
8
+ base.has_many :alchemy_ingredients, class_name: "Alchemy::Ingredients::SpreeProduct", as: :related_object, dependent: :nullify
9
+ end
10
+
11
+ private
12
+
13
+ # Overwritten Solidus' default behavior
14
+ #
15
+ # The Solidus implementation did not trigger `touch` on taxons, but
16
+ # updated the `updated_at` timestamp in an `update_all`.
17
+ #
18
+ # Since we want to invalidate ingredient spree taxons cache as well
19
+ # we need to use `touch` here and use the `after_touch` callback of
20
+ # Spree::Taxon
21
+ #
22
+ def touch_taxons
23
+ taxons.each(&:touch)
24
+ end
25
+
26
+ ::Spree::Product.prepend self
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Alchemy
4
+ module Solidus
5
+ module SpreeTaxonDecorator
6
+ def self.prepended(base)
7
+ base.include Alchemy::Solidus::TouchAlchemyIngredients
8
+ base.has_many :alchemy_ingredients, class_name: "Alchemy::Ingredients::SpreeTaxon", as: :related_object, dependent: :nullify
9
+ end
10
+
11
+ ::Spree::Taxon.prepend self
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Alchemy
4
+ module Solidus
5
+ module SpreeVariantDecorator
6
+ def self.prepended(base)
7
+ base.include Alchemy::Solidus::TouchAlchemyIngredients
8
+ base.has_many :alchemy_ingredients, class_name: "Alchemy::Ingredients::SpreeVariant", as: :related_object, dependent: :nullify
9
+ end
10
+
11
+ ::Spree::Variant.prepend self
12
+ end
13
+ end
14
+ end
@@ -1,3 +1,5 @@
1
+ import "alchemy_solidus/product_select"
2
+
1
3
  export default class ProductSelect extends HTMLElement {
2
4
  connectedCallback() {
3
5
  const input = this.querySelector("#product_link")
@@ -1,7 +1,7 @@
1
- //= require alchemy/solidus/admin/select2_config
1
+ import { getSelect2Config } from "alchemy_solidus/select2_config"
2
2
 
3
3
  $.fn.alchemyProductSelect = function (options) {
4
- var config = Alchemy.Solidus.getSelect2Config(options)
4
+ const config = getSelect2Config(options)
5
5
 
6
6
  function formatResultObject(product) {
7
7
  return {
@@ -10,9 +10,9 @@ $.fn.alchemyProductSelect = function (options) {
10
10
  }
11
11
  }
12
12
 
13
- var select2config = Object.assign(config, {
13
+ const select2config = Object.assign(config, {
14
14
  ajax: Object.assign(config.ajax, {
15
- data: function (term, page) {
15
+ data(term, page) {
16
16
  return {
17
17
  q: Object.assign(
18
18
  {
@@ -23,7 +23,7 @@ $.fn.alchemyProductSelect = function (options) {
23
23
  page: page,
24
24
  }
25
25
  },
26
- results: function (data, page) {
26
+ results(data, page) {
27
27
  return {
28
28
  results: data.products.map(
29
29
  options.formatResultObject || formatResultObject
@@ -1,8 +1,5 @@
1
- Alchemy = window.Alchemy || {}
2
- Alchemy.Solidus = Alchemy.Solidus || {}
3
-
4
- Alchemy.Solidus.getSelect2Config = function (options) {
5
- var headers = {
1
+ export function getSelect2Config(options) {
2
+ const headers = {
6
3
  Authorization: "Bearer " + options.apiToken,
7
4
  }
8
5
 
@@ -0,0 +1,37 @@
1
+ import { getSelect2Config } from "alchemy_solidus/select2_config"
2
+
3
+ $.fn.alchemyTaxonSelect = function (options) {
4
+ const config = getSelect2Config(options)
5
+
6
+ this.select2(
7
+ $.extend(true, config, {
8
+ ajax: {
9
+ data(term, page) {
10
+ return {
11
+ q: $.extend(
12
+ {
13
+ name_cont: term,
14
+ },
15
+ options.query_params
16
+ ),
17
+ page: page,
18
+ }
19
+ },
20
+ results(data, page) {
21
+ return {
22
+ results: data.taxons.map(function (taxon) {
23
+ return {
24
+ id: taxon.id,
25
+ text: taxon.pretty_name,
26
+ }
27
+ }),
28
+ more: page * data.per_page < data.total_count,
29
+ }
30
+ },
31
+ },
32
+ formatSelection(taxon) {
33
+ return taxon.text || taxon.name
34
+ },
35
+ })
36
+ )
37
+ }
@@ -1,7 +1,7 @@
1
- //= require alchemy/solidus/admin/select2_config
1
+ import { getSelect2Config } from "alchemy_solidus/select2_config"
2
2
 
3
3
  $.fn.alchemyVariantSelect = function (options) {
4
- const config = Alchemy.Solidus.getSelect2Config(options)
4
+ const config = getSelect2Config(options)
5
5
 
6
6
  function formatSelection(variant) {
7
7
  return variant.options_text
@@ -30,7 +30,7 @@ $.fn.alchemyVariantSelect = function (options) {
30
30
  this.select2(
31
31
  $.extend(true, config, {
32
32
  ajax: {
33
- data: function (term, page) {
33
+ data(term, page) {
34
34
  return {
35
35
  q: $.extend(
36
36
  {
@@ -41,7 +41,7 @@ $.fn.alchemyVariantSelect = function (options) {
41
41
  page: page,
42
42
  }
43
43
  },
44
- results: function (data, page) {
44
+ results(data, page) {
45
45
  return {
46
46
  results: data.variants,
47
47
  more: page * data.per_page < data.total_count,
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Alchemy
4
+ module Solidus
5
+ module TouchAlchemyIngredients
6
+ extend ActiveSupport::Concern
7
+
8
+ included do
9
+ after_update :touch_alchemy_ingredients
10
+ after_touch :touch_alchemy_ingredients
11
+ end
12
+
13
+ private
14
+
15
+ def touch_alchemy_ingredients
16
+ alchemy_ingredients.each(&:touch)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -10,7 +10,9 @@
10
10
  <% end %>
11
11
  <% end %>
12
12
 
13
- <script>
13
+ <script type="module">
14
+ import "alchemy_solidus/product_select"
15
+
14
16
  $('#<%= spree_product_editor.form_field_id(:product_id) %>').alchemyProductSelect({
15
17
  placeholder: "<%= Alchemy.t(:search_product, scope: 'solidus') %>",
16
18
  apiToken: "<%= current_alchemy_user.spree_api_key %>",
@@ -10,7 +10,9 @@
10
10
  <% end %>
11
11
  <% end %>
12
12
 
13
- <script>
13
+ <script type="module">
14
+ import "alchemy_solidus/taxon_select"
15
+
14
16
  $('#<%= spree_taxon_editor.form_field_id(:taxon_id) %>').alchemyTaxonSelect({
15
17
  placeholder: "<%= Alchemy.t(:search_taxon, scope: 'solidus') %>",
16
18
  apiToken: "<%= current_alchemy_user.spree_api_key %>",
@@ -29,7 +29,9 @@
29
29
  }
30
30
  </style>
31
31
 
32
- <script>
32
+ <script type="module">
33
+ import "alchemy_solidus/variant_select"
34
+
33
35
  $('#<%= spree_variant_editor.form_field_id(:variant_id) %>').alchemyVariantSelect({
34
36
  placeholder: "<%= Alchemy.t(:search_variant, scope: 'solidus') %>",
35
37
  apiToken: "<%= current_alchemy_user.spree_api_key %>",
@@ -18,11 +18,6 @@ alchemy_module = {
18
18
  action: 'index',
19
19
  name: 'Products'
20
20
  },
21
- {
22
- controller: '/spree/admin/promotions',
23
- action: 'index',
24
- name: 'Promotions'
25
- },
26
21
  {
27
22
  controller: '/spree/admin/stock_items',
28
23
  action: 'index',
@@ -1,5 +1,5 @@
1
1
  module Alchemy
2
2
  module Solidus
3
- VERSION = "7.3.2"
3
+ VERSION = "7.5.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy-solidus
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.3.2
4
+ version: 7.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-09-11 00:00:00.000000000 Z
10
+ date: 2025-01-24 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: alchemy_cms
@@ -166,14 +165,14 @@ dependencies:
166
165
  requirements:
167
166
  - - "~>"
168
167
  - !ruby/object:Gem::Version
169
- version: '4.8'
168
+ version: '6.4'
170
169
  type: :development
171
170
  prerelease: false
172
171
  version_requirements: !ruby/object:Gem::Requirement
173
172
  requirements:
174
173
  - - "~>"
175
174
  - !ruby/object:Gem::Version
176
- version: '4.8'
175
+ version: '6.4'
177
176
  - !ruby/object:Gem::Dependency
178
177
  name: ffaker
179
178
  requirement: !ruby/object:Gem::Requirement
@@ -242,24 +241,24 @@ files:
242
241
  - Rakefile
243
242
  - app/assets/config/alchemy_solidus/manifest.js
244
243
  - app/assets/javascripts/alchemy/solidus/admin.js
245
- - app/assets/javascripts/alchemy/solidus/admin/product_select.js
246
- - app/assets/javascripts/alchemy/solidus/admin/select2_config.js
247
- - app/assets/javascripts/alchemy/solidus/admin/taxon_select.js
248
- - app/assets/javascripts/alchemy/solidus/admin/variant_select.js
249
244
  - app/components/alchemy/admin/link_dialog/product_tab.rb
250
245
  - app/components/alchemy/admin/product_select.rb
251
246
  - app/components/alchemy/ingredients/spree_product_view.rb
252
247
  - app/components/alchemy/ingredients/spree_taxon_view.rb
253
248
  - app/components/alchemy/ingredients/spree_variant_view.rb
254
- - app/decorators/models/spree/spree_product_decorator.rb
255
- - app/decorators/models/spree/spree_taxon_decorator.rb
256
- - app/decorators/models/spree/spree_variant_decorator.rb
249
+ - app/decorators/models/alchemy/solidus/spree_product_decorator.rb
250
+ - app/decorators/models/alchemy/solidus/spree_taxon_decorator.rb
251
+ - app/decorators/models/alchemy/solidus/spree_variant_decorator.rb
257
252
  - app/javascript/alchemy_solidus.js
258
253
  - app/javascript/alchemy_solidus/components/product_select.js
254
+ - app/javascript/alchemy_solidus/product_select.js
255
+ - app/javascript/alchemy_solidus/select2_config.js
256
+ - app/javascript/alchemy_solidus/taxon_select.js
257
+ - app/javascript/alchemy_solidus/variant_select.js
259
258
  - app/models/alchemy/ingredients/spree_product.rb
260
259
  - app/models/alchemy/ingredients/spree_taxon.rb
261
260
  - app/models/alchemy/ingredients/spree_variant.rb
262
- - app/models/alchemy_solidus/touch_alchemy_ingredients.rb
261
+ - app/models/alchemy/solidus/touch_alchemy_ingredients.rb
263
262
  - app/overrides/alchemy/admin/pages/link/product_link.html.erb.deface
264
263
  - app/overrides/alchemy/admin/pages/link/product_link_panel.html.erb.deface
265
264
  - app/overrides/alchemy/admin/pages/link/product_link_sl_tab.html.erb.deface
@@ -296,7 +295,6 @@ homepage: https://github.com/AlchemyCMS/alchemy-solidus
296
295
  licenses:
297
296
  - BSD-3-Clause
298
297
  metadata: {}
299
- post_install_message:
300
298
  rdoc_options: []
301
299
  require_paths:
302
300
  - lib
@@ -311,8 +309,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
311
309
  - !ruby/object:Gem::Version
312
310
  version: '0'
313
311
  requirements: []
314
- rubygems_version: 3.5.16
315
- signing_key:
312
+ rubygems_version: 3.6.3
316
313
  specification_version: 4
317
314
  summary: The World's Most Flexible E-Commerce Platform meets The World's Most Flexible
318
315
  Content Management System!
@@ -1,32 +0,0 @@
1
- //= require alchemy/solidus/admin/select2_config
2
-
3
- $.fn.alchemyTaxonSelect = function(options) {
4
- var config = Alchemy.Solidus.getSelect2Config(options)
5
-
6
- this.select2($.extend(true, config, {
7
- ajax: {
8
- data: function(term, page) {
9
- return {
10
- q: $.extend({
11
- name_cont: term
12
- }, options.query_params),
13
- page: page
14
- }
15
- },
16
- results: function(data, page) {
17
- return {
18
- results: data.taxons.map(function(taxon) {
19
- return {
20
- id: taxon.id,
21
- text: taxon.pretty_name
22
- }
23
- }),
24
- more: page * data.per_page < data.total_count
25
- }
26
- }
27
- },
28
- formatSelection: function(taxon) {
29
- return taxon.text || taxon.name
30
- }
31
- }))
32
- }
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Spree
4
- module SpreeProductDecorator
5
- def self.prepended(base)
6
- base.include AlchemySolidus::TouchAlchemyIngredients
7
- base.has_many :alchemy_ingredients, class_name: "Alchemy::Ingredients::SpreeProduct", as: :related_object, dependent: :nullify
8
- end
9
-
10
- private
11
-
12
- # Overwritten Solidus' default behavior
13
- #
14
- # The Solidus implementation did not trigger `touch` on taxons, but
15
- # updated the `updated_at` timestamp in an `update_all`.
16
- #
17
- # Since we want to invalidate ingredient spree taxons cache as well
18
- # we need to use `touch` here and use the `after_touch` callback of
19
- # Spree::Taxon
20
- #
21
- def touch_taxons
22
- taxons.each(&:touch)
23
- end
24
-
25
- ::Spree::Product.prepend self
26
- end
27
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Spree
4
- module SpreeTaxonDecorator
5
- def self.prepended(base)
6
- base.include AlchemySolidus::TouchAlchemyIngredients
7
- base.has_many :alchemy_ingredients, class_name: "Alchemy::Ingredients::SpreeTaxon", as: :related_object, dependent: :nullify
8
- end
9
-
10
- ::Spree::Taxon.prepend self
11
- end
12
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Spree
4
- module SpreeVariantDecorator
5
- def self.prepended(base)
6
- base.include AlchemySolidus::TouchAlchemyIngredients
7
- base.has_many :alchemy_ingredients, class_name: "Alchemy::Ingredients::SpreeVariant", as: :related_object, dependent: :nullify
8
- end
9
-
10
- ::Spree::Variant.prepend self
11
- end
12
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module AlchemySolidus
4
- module TouchAlchemyIngredients
5
- extend ActiveSupport::Concern
6
-
7
- included do
8
- after_update :touch_alchemy_ingredients
9
- after_touch :touch_alchemy_ingredients
10
- end
11
-
12
- private
13
-
14
- def touch_alchemy_ingredients
15
- alchemy_ingredients.each(&:touch)
16
- end
17
- end
18
- end