alchemy-solidus 8.0.0 → 8.1.0

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: d8cad8065778996d89836876d20d31bd980d14487ef410e8fe258fa53de0853f
4
- data.tar.gz: 62192b627bf044c89291dd44f0ed1caf3d23a66c00106a29655186c498ad0b63
3
+ metadata.gz: 7f430eef503b1316b367b98550bd8dc9154fa4a042695b38f55b14177c245c96
4
+ data.tar.gz: e872e1bf804dda6d5a9cfc60936818af8409ec5896b9fd7981daa52b9ce6301f
5
5
  SHA512:
6
- metadata.gz: d0220db8a6ed1cf6788d7b3d895bb299f93fb7dd513642792eff4a33171a0b17268b0737a34caea2900d8810843b0ce212ab2c882e003ca6a239972333cb11fe
7
- data.tar.gz: 3f69ec0a25642f70d352fffd472c4e0e079904d26c7291e754f8b681b177b69e5109c2c34fa006eb4e1c8eb30e544b5e60ca672251426ab1aabd2c1002aa3f20
6
+ metadata.gz: 381b2949455b301e3b4eb336904becdf86c36dfd1ef12558f8b22465e79b724ec35a2286f3e73de4194c2c504f7758114b6afadabdaadb50de1e2eed98864afd
7
+ data.tar.gz: 2ba6d5d1aa1c0e520b288c909ad58f66be3dba275c84ffc74a3ad509fda13b6cb40b7c10fd3030858cdc96260d83858cf5516313c0cf643b6cafdf61a72e1b2c
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![CI](https://github.com/AlchemyCMS/alchemy-solidus/actions/workflows/ci.yml/badge.svg)](https://github.com/AlchemyCMS/alchemy-solidus/actions/workflows/ci.yml)
1
+ [![Test](https://github.com/AlchemyCMS/alchemy-solidus/actions/workflows/test.yml/badge.svg)](https://github.com/AlchemyCMS/alchemy-solidus/actions/workflows/test.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
@@ -12,7 +12,7 @@ Development and maintenance is sponsored by [Blish](https://blish.cloud/).
12
12
  This is a [AlchemyCMS](https://alchemy-cms.com) and [Solidus](https://solidus.io) integration gem.
13
13
 
14
14
  1. It provides tabs in Alchemy and Solidus menus to easily switch between both backends
15
- 2. It offers two new Essences for Alchemy called `EssenceSpreeProduct` and `EssenceSpreeTaxon` that you can use to place Spree products and/or Taxons on your pages.
15
+ 2. It offers new Ingredients for Alchemy called `SpreeProduct`, `SpreeVariant` and `SpreeTaxon` that you can use to place Solidus products and/or Taxons on your pages.
16
16
  3. Shares admin sessions and user abilities between Alchemy and Solidus.
17
17
 
18
18
  ## Compatibility
@@ -30,8 +30,10 @@ This version runs with Solidus v4.0 and up.
30
30
 
31
31
  ### Alchemy
32
32
 
33
- This version runs with Alchemy v7.2
33
+ This version runs with Alchemy v8.1
34
34
 
35
+ - For a Alchemy 8.0 compatible version please use the `8.0-stable` branch or `8.0` gem version.
36
+ - For a Alchemy 7.4 compatible version please use the `7.4-stable` branch or `7.4` gem version.
35
37
  - For a Alchemy 7.0/7.1 compatible version please use the `7.2-stable` branch or `7.2` gem version.
36
38
  - For a Alchemy 6.x compatible version please use the `5.0-stable` branch or `5.0` gem version.
37
39
  - For a Alchemy 5.x compatible version please use the `4.1-stable` branch or `4.1` gem version.
@@ -44,7 +46,7 @@ This version runs with Alchemy v7.2
44
46
  Add this line to your applications `Gemfile`:
45
47
 
46
48
  ```ruby
47
- gem 'alchemy-solidus', '~> 7.0'
49
+ gem 'alchemy-solidus', '~> 8.0'
48
50
  ```
49
51
 
50
52
  Install the gem with:
@@ -99,8 +101,8 @@ To use Solidus Auth Devise, instruct Alchemy to use the `Spree::User` class:
99
101
 
100
102
  ```ruby
101
103
  # config/initializers/alchemy.rb
102
- Alchemy.user_class_name = 'Spree::User'
103
- Alchemy.current_user_method = :spree_current_user
104
+ Alchemy.config.user_class = 'Spree::User'
105
+ Alchemy.config.current_user_method = :spree_current_user
104
106
  ```
105
107
 
106
108
  If you put Spree in it's own routing namespace (see below) you will want to
@@ -108,8 +110,8 @@ let Alchemy know these paths:
108
110
 
109
111
  ```ruby
110
112
  # config/initializers/alchemy.rb
111
- Alchemy.login_path = '/store/login'
112
- Alchemy.logout_path = '/store/logout'
113
+ Alchemy.config.login_path = '/store/login'
114
+ Alchemy.config.logout_path = '/store/logout'
113
115
  ```
114
116
 
115
117
  #### 2. Option: Use [Alchemy Devise](https://github.com/AlchemyCMS/alchemy-devise)
@@ -122,7 +124,7 @@ Add `alchemy-devise` to your `Gemfile`
122
124
 
123
125
  ```ruby
124
126
  # Gemfile
125
- gem 'alchemy-devise', '~> 4.1'
127
+ gem 'alchemy-devise', '~> 5.0'
126
128
  ```
127
129
 
128
130
  and install it:
@@ -161,15 +163,15 @@ and tell Solidus about Alchemy's path helpers:
161
163
  # lib/spree/authentication_helpers.rb
162
164
  ...
163
165
  def spree_login_path
164
- Alchemy.login_path
166
+ Alchemy.config.login_path
165
167
  end
166
168
 
167
169
  def spree_signup_path
168
- Alchemy.signup_path
170
+ Alchemy.config.signup_path
169
171
  end
170
172
 
171
173
  def spree_logout_path
172
- Alchemy.logout_path
174
+ Alchemy.config.logout_path
173
175
  end
174
176
  ...
175
177
  ```
data/Rakefile CHANGED
@@ -14,11 +14,12 @@ task default: %i[test_setup spec]
14
14
 
15
15
  desc "Setup test app"
16
16
  task :test_setup do
17
- solidus_branch = ENV.fetch("SOLIDUS_BRANCH", "v4.4")
17
+ solidus_branch = ENV.fetch("SOLIDUS_BRANCH", "v4.6")
18
18
  solidus_install_options = "--payment-method=none --frontend=none --authentication=none"
19
19
  if ["v4.5", "v4.6", "main"].include?(solidus_branch)
20
20
  solidus_install_options += " --admin-preview=false"
21
21
  end
22
+ ENV["SKIP_SOLIDUS_BOLT"] = "1" # solidus_frontend defaults to installing solidus_bolt if auto-accept is used
22
23
  Dir.chdir("spec/dummy") do
23
24
  system <<~SETUP
24
25
  bin/rake db:environment:set db:drop && \
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Alchemy
4
+ module Ingredients
5
+ class SpreeProductEditor < BaseEditor
6
+ delegate :product, to: :ingredient
7
+
8
+ def input_field
9
+ render Alchemy::Admin::ProductSelect.new(api_key, product:, query_params:) do
10
+ text_field_tag form_field_name(:product_id),
11
+ product&.id,
12
+ id: form_field_id(:product_id),
13
+ class: "full_width"
14
+ end
15
+ end
16
+
17
+ private
18
+
19
+ def api_key = helpers.current_alchemy_user&.spree_api_key
20
+ def query_params = settings[:query_params]
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Alchemy
4
+ module Ingredients
5
+ class SpreeTaxonEditor < BaseEditor
6
+ delegate :taxon, to: :ingredient
7
+
8
+ def input_field
9
+ render Alchemy::Admin::TaxonSelect.new(api_key, taxon:, query_params:) do
10
+ text_field_tag form_field_name(:taxon_id),
11
+ taxon&.id,
12
+ id: form_field_id(:taxon_id),
13
+ class: "full_width"
14
+ end
15
+ end
16
+
17
+ private
18
+
19
+ def api_key = helpers.current_alchemy_user&.spree_api_key
20
+ def query_params = settings[:query_params]
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Alchemy
4
+ module Ingredients
5
+ class SpreeVariantEditor < BaseEditor
6
+ delegate :variant, to: :ingredient
7
+
8
+ def input_field
9
+ render Alchemy::Admin::VariantSelect.new(api_key, variant:, query_params:) do
10
+ text_field_tag form_field_name(:variant_id),
11
+ variant&.id,
12
+ id: form_field_id(:variant_id),
13
+ class: "full_width"
14
+ end
15
+ end
16
+
17
+ private
18
+
19
+ def api_key = helpers.current_alchemy_user&.spree_api_key
20
+ def query_params = settings[:query_params]
21
+ end
22
+ end
23
+ end
@@ -4,7 +4,7 @@ module Alchemy
4
4
  module Solidus
5
5
  module ApplicationControllerPatch
6
6
  def spree_current_user
7
- if Alchemy.user_class_name == "::Alchemy::User"
7
+ if Alchemy.config.user_class_name == "::Alchemy::User"
8
8
  current_user
9
9
  else
10
10
  super
@@ -5,7 +5,7 @@ alchemy_module = {
5
5
  controller: "/spree/admin/orders",
6
6
  action: "index",
7
7
  name: "Store",
8
- icon: (Alchemy.gem_version >= Gem::Version.new("7.4.0.a")) ? "shopping-cart" : "shopping-cart-line",
8
+ icon: "shopping-cart",
9
9
  data: {turbolinks: false, turbo: false},
10
10
  sub_navigation: [
11
11
  {
@@ -35,13 +35,10 @@ if defined?(Spree::Auth::Engine)
35
35
  name: "Users"
36
36
  }
37
37
  )
38
- Alchemy.user_class_name = "Spree::User"
39
- Alchemy.current_user_method = :spree_current_user
40
-
41
- if Alchemy.respond_to?(:logout_method)
42
- Rails.application.config.after_initialize do
43
- Alchemy.logout_method = Devise.sign_out_via
44
- end
38
+ Alchemy.config.user_class = "Spree::User"
39
+ Alchemy.config.current_user_method = :spree_current_user
40
+ Rails.application.config.after_initialize do
41
+ Alchemy.config.logout_method = Devise.sign_out_via.to_s
45
42
  end
46
43
  end
47
44
 
@@ -30,7 +30,7 @@ module Alchemy
30
30
  end
31
31
 
32
32
  config.to_prepare do
33
- Alchemy.register_ability ::Spree::Ability
33
+ Alchemy.config.abilities.add("Spree::Ability")
34
34
  ::Spree::Ability.register_ability ::Alchemy::Permissions
35
35
 
36
36
  if SolidusSupport.frontend_available?
@@ -1,5 +1,5 @@
1
1
  module Alchemy
2
2
  module Solidus
3
- VERSION = "8.0.0"
3
+ VERSION = "8.1.0"
4
4
  end
5
5
  end
@@ -4,14 +4,14 @@ module Alchemy
4
4
  module Solidus
5
5
  module SpreeAdminBaseControllerPatch
6
6
  def self.prepended(base)
7
- if Alchemy.user_class_name == "::Alchemy::User"
7
+ if Alchemy.config.user_class_name == "::Alchemy::User"
8
8
  base.unauthorized_redirect = -> do
9
9
  if spree_current_user
10
10
  flash[:error] = I18n.t("spree.authorization_failure")
11
11
  redirect_to spree.root_path
12
12
  else
13
13
  store_location
14
- redirect_to Alchemy.login_path
14
+ redirect_to Alchemy.config.login_path
15
15
  end
16
16
  end
17
17
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy-solidus
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.0
4
+ version: 8.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
@@ -15,7 +15,7 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: 8.0.0.b
18
+ version: 8.1.0.a
19
19
  - - "<"
20
20
  - !ruby/object:Gem::Version
21
21
  version: '9'
@@ -25,7 +25,7 @@ dependencies:
25
25
  requirements:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
- version: 8.0.0.b
28
+ version: 8.1.0.a
29
29
  - - "<"
30
30
  - !ruby/object:Gem::Version
31
31
  version: '9'
@@ -264,8 +264,11 @@ files:
264
264
  - app/components/alchemy/admin/product_select.rb
265
265
  - app/components/alchemy/admin/taxon_select.rb
266
266
  - app/components/alchemy/admin/variant_select.rb
267
+ - app/components/alchemy/ingredients/spree_product_editor.rb
267
268
  - app/components/alchemy/ingredients/spree_product_view.rb
269
+ - app/components/alchemy/ingredients/spree_taxon_editor.rb
268
270
  - app/components/alchemy/ingredients/spree_taxon_view.rb
271
+ - app/components/alchemy/ingredients/spree_variant_editor.rb
269
272
  - app/components/alchemy/ingredients/spree_variant_view.rb
270
273
  - app/javascript/alchemy_solidus.js
271
274
  - app/javascript/alchemy_solidus/components/ajax_config.js
@@ -293,12 +296,6 @@ files:
293
296
  - app/patches/models/alchemy/solidus/spree_taxon_patch.rb
294
297
  - app/patches/models/alchemy/solidus/spree_user_patch.rb
295
298
  - app/patches/models/alchemy/solidus/spree_variant_patch.rb
296
- - app/views/alchemy/ingredients/_spree_product_editor.html.erb
297
- - app/views/alchemy/ingredients/_spree_product_view.html.erb
298
- - app/views/alchemy/ingredients/_spree_taxon_editor.html.erb
299
- - app/views/alchemy/ingredients/_spree_taxon_view.html.erb
300
- - app/views/alchemy/ingredients/_spree_variant_editor.html.erb
301
- - app/views/alchemy/ingredients/_spree_variant_view.html.erb
302
299
  - app/views/spree/admin/shared/_alchemy_sub_menu.html.erb
303
300
  - config/importmap.rb
304
301
  - config/initializers/alchemy.rb
@@ -332,7 +329,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
332
329
  - !ruby/object:Gem::Version
333
330
  version: '0'
334
331
  requirements: []
335
- rubygems_version: 3.6.9
332
+ rubygems_version: 4.0.3
336
333
  specification_version: 4
337
334
  summary: The World's Most Flexible E-Commerce Platform meets The World's Most Flexible
338
335
  Content Management System!
@@ -1,17 +0,0 @@
1
- <%= content_tag :div,
2
- class: spree_product_editor.css_classes,
3
- data: spree_product_editor.data_attributes do %>
4
- <%= element_form.fields_for(:ingredients, spree_product_editor.ingredient) do |f| %>
5
- <%= ingredient_label(spree_product_editor, :product_id) %>
6
- <%= render Alchemy::Admin::ProductSelect.new(
7
- current_alchemy_user.spree_api_key,
8
- query_params: spree_product_editor.settings[:query_params],
9
- product: spree_product_editor.product
10
- ) do %>
11
- <%= f.text_field :product_id,
12
- value: spree_product_editor.product&.id,
13
- id: spree_product_editor.form_field_id(:product_id),
14
- class: 'full_width' %>
15
- <% end %>
16
- <% end %>
17
- <% end %>
@@ -1,4 +0,0 @@
1
- <%= render spree_product_view.as_view_component(
2
- **local_assigns.slice(:options),
3
- **local_assigns.slice(:html_options)
4
- ) -%>
@@ -1,17 +0,0 @@
1
- <%= content_tag :div,
2
- class: spree_taxon_editor.css_classes,
3
- data: spree_taxon_editor.data_attributes do %>
4
- <%= element_form.fields_for(:ingredients, spree_taxon_editor.ingredient) do |f| %>
5
- <%= ingredient_label(spree_taxon_editor, :taxon_id) %>
6
- <%= render Alchemy::Admin::TaxonSelect.new(
7
- current_alchemy_user.spree_api_key,
8
- query_params: spree_taxon_editor.settings[:query_params],
9
- taxon: spree_taxon_editor.ingredient.taxon
10
- ) do %>
11
- <%= f.text_field :taxon_id,
12
- value: spree_taxon_editor.taxon&.id,
13
- id: spree_taxon_editor.form_field_id(:taxon_id),
14
- class: "full_width" %>
15
- <% end %>
16
- <% end %>
17
- <% end %>
@@ -1,4 +0,0 @@
1
- <%= render spree_taxon_view.as_view_component(
2
- **local_assigns.slice(:options),
3
- **local_assigns.slice(:html_options)
4
- ) -%>
@@ -1,36 +0,0 @@
1
- <%= content_tag :div,
2
- class: spree_variant_editor.css_classes,
3
- data: spree_variant_editor.data_attributes do %>
4
- <%= element_form.fields_for(:ingredients, spree_variant_editor.ingredient) do |f| %>
5
- <%= ingredient_label(spree_variant_editor, :variant_id) %>
6
- <%= render Alchemy::Admin::VariantSelect.new(
7
- current_alchemy_user.spree_api_key,
8
- query_params: spree_variant_editor.settings[:query_params],
9
- variant: spree_variant_editor.ingredient.variant
10
- ) do %>
11
- <%= f.text_field :variant_id,
12
- value: spree_variant_editor.variant&.id,
13
- id: spree_variant_editor.form_field_id(:variant_id),
14
- class: 'alchemy_selectbox full_width' %>
15
- <% end %>
16
- <% end %>
17
- <% end %>
18
-
19
- <style>
20
- .variant-select-result > * {
21
- display: flex;
22
- justify-content: space-between;
23
- min-height: 16px;
24
-
25
- > span {
26
- display: inline-block;
27
- overflow: hidden;
28
- text-overflow: ellipsis;
29
- white-space: nowrap;
30
- }
31
-
32
- &:last-child {
33
- color: hsl(224, 8%, 63%);
34
- }
35
- }
36
- </style>
@@ -1,4 +0,0 @@
1
- <%= render spree_variant_view.as_view_component(
2
- **local_assigns.slice(:options),
3
- **local_assigns.slice(:html_options)
4
- ) -%>