alchemy-solidus 3.1.1 → 4.0.0.pre.b1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0a6e12d7505ec9bc89770302454888523f6c5fe4853bc46f49596b2f2c0380aa
4
- data.tar.gz: 6a57eba2ac492aae30aa9df6ae32a9a48c3237210f0bcf6028b2e270ac25bebe
3
+ metadata.gz: 2797433a6a97d7d6afe3a5e651ae43db159b2f8609770b9e8ea2d856dd4cc820
4
+ data.tar.gz: 4760ab7f6075ed49fdb8187a4071c05e80aa1b617b47e6c8bf80af2e01c844be
5
5
  SHA512:
6
- metadata.gz: 2f25bad30b4d80f28b066d1631ea7cbd0dd750490c8e3bdf8b731c83bcbf87080a273e6067b499295c5017cdf87d317190aed4fa207477cd166f45a6169aa018
7
- data.tar.gz: 63b56091e7f023645b5de9c7212587852741fe2e6dbae826e12f1dc79e8c268f1b4248e5498c97d2aebb4bc9a7c5d782dfe61d5d6300f66c57b8b0ec9316de1a
6
+ metadata.gz: 780ba8c209dca6820184f50b064ddb31613da1897c8f3365626926638cceabf6686ca675fb5c2a68335f49133e2a2ed1e9dc28e93f7b7bc4cd499a2580e3f23b
7
+ data.tar.gz: d63f7d35521a3567b4c56aa725623bc04041ebee06e63658cbb13db76fc31beaeac817001d840bc475c6432f9fcab543ab61cf31ae865be683b4a9edb892bfa0
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Build Status](https://travis-ci.org/AlchemyCMS/alchemy-solidus.svg?branch=master)](https://travis-ci.org/AlchemyCMS/alchemy-solidus)
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)
2
2
  [![Gem Version](https://badge.fury.io/rb/alchemy-solidus.svg)](https://badge.fury.io/rb/alchemy-solidus)
3
3
 
4
4
  # Alchemy-Solidus
@@ -18,7 +18,7 @@ $.fn.alchemyTaxonSelect = function(options) {
18
18
  results: data.taxons.map(function(taxon) {
19
19
  return {
20
20
  id: taxon.id,
21
- text: taxon.name
21
+ text: taxon.pretty_name
22
22
  }
23
23
  }),
24
24
  more: page * data.per_page < data.total_count
@@ -4,14 +4,16 @@ module Alchemy
4
4
  class EssenceSpreeProduct < ActiveRecord::Base
5
5
  PRODUCT_ID = /\A\d+\z/
6
6
 
7
- belongs_to :product, class_name: 'Spree::Product',
8
- optional: true, foreign_key: 'spree_product_id'
7
+ belongs_to :product,
8
+ class_name: "Spree::Product",
9
+ optional: true,
10
+ foreign_key: "spree_product_id"
9
11
 
10
12
  acts_as_essence(ingredient_column: :product)
11
13
 
12
14
  def ingredient=(product_or_id)
13
15
  case product_or_id
14
- when PRODUCT_ID
16
+ when PRODUCT_ID, ""
15
17
  self.spree_product_id = product_or_id
16
18
  when Spree::Product
17
19
  self.product = product_or_id
@@ -4,14 +4,16 @@ module Alchemy
4
4
  class EssenceSpreeTaxon < ActiveRecord::Base
5
5
  TAXON_ID = /\A\d+\z/
6
6
 
7
- belongs_to :taxon, class_name: 'Spree::Taxon',
8
- optional: true, foreign_key: 'taxon_id'
7
+ belongs_to :taxon,
8
+ class_name: "Spree::Taxon",
9
+ optional: true,
10
+ foreign_key: "taxon_id"
9
11
 
10
12
  acts_as_essence(ingredient_column: :taxon)
11
13
 
12
14
  def ingredient=(taxon_or_id)
13
15
  case taxon_or_id
14
- when TAXON_ID
16
+ when TAXON_ID, ""
15
17
  self.taxon_id = taxon_or_id
16
18
  when Spree::Taxon
17
19
  self.taxon = taxon_or_id
@@ -4,13 +4,15 @@ module Alchemy
4
4
  class EssenceSpreeVariant < ActiveRecord::Base
5
5
  VARIANT_ID = /\A\d+\z/
6
6
 
7
- belongs_to :variant, class_name: 'Spree::Variant', optional: true
7
+ belongs_to :variant,
8
+ class_name: "Spree::Variant",
9
+ optional: true
8
10
 
9
11
  acts_as_essence(ingredient_column: :variant)
10
12
 
11
13
  def ingredient=(variant_or_id)
12
14
  case variant_or_id
13
- when VARIANT_ID
15
+ when VARIANT_ID, ""
14
16
  self.variant_id = variant_or_id
15
17
  when Spree::Variant
16
18
  self.variant = variant_or_id
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Alchemy
4
+ module Ingredients
5
+ class SpreeProduct < Alchemy::Ingredient
6
+ related_object_alias :product, class_name: "Spree::Product"
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Alchemy
4
+ module Ingredients
5
+ class SpreeTaxon < Alchemy::Ingredient
6
+ related_object_alias :taxon, class_name: "Spree::Taxon"
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Alchemy
4
+ module Ingredients
5
+ class SpreeVariant < Alchemy::Ingredient
6
+ related_object_alias :variant, class_name: "Spree::Variant"
7
+ end
8
+ end
9
+ end
@@ -19,7 +19,7 @@
19
19
  <% if content.essence.taxon %>
20
20
  initialSelection: {
21
21
  id: <%= content.essence.taxon_id %>,
22
- text: "<%= content.essence.taxon.name %>"
22
+ text: "<%= content.essence.taxon.pretty_name %>"
23
23
  }
24
24
  <% end %>
25
25
  })
@@ -0,0 +1,25 @@
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
+ <%= f.text_field :product_id,
7
+ value: spree_product_editor.product&.id,
8
+ class: 'alchemy_selectbox full_width' %>
9
+ <% end %>
10
+ <% end %>
11
+
12
+ <script>
13
+ $('#<%= spree_product_editor.form_field_id(:product_id) %>').alchemyProductSelect({
14
+ placeholder: "<%= Alchemy.t(:search_product, scope: 'solidus') %>",
15
+ apiToken: "<%= current_alchemy_user.spree_api_key %>",
16
+ baseUrl: "<%= spree.api_products_path %>",
17
+ query_params: <%== spree_product_editor.settings[:query_params].to_json %>,
18
+ <% if spree_product_editor.product %>
19
+ initialSelection: {
20
+ id: <%= spree_product_editor.product.id %>,
21
+ text: "<%= spree_product_editor.product.name %>"
22
+ }
23
+ <% end %>
24
+ })
25
+ </script>
@@ -0,0 +1 @@
1
+ <%= spree_product_view.product&.name %>
@@ -0,0 +1,25 @@
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
+ <%= f.text_field :taxon_id,
7
+ value: spree_taxon_editor.taxon&.id,
8
+ class: 'alchemy_selectbox full_width' %>
9
+ <% end %>
10
+ <% end %>
11
+
12
+ <script>
13
+ $('#<%= spree_taxon_editor.form_field_id(:taxon_id) %>').alchemyTaxonSelect({
14
+ placeholder: "<%= Alchemy.t(:search_taxon, scope: 'solidus') %>",
15
+ apiToken: "<%= current_alchemy_user.spree_api_key %>",
16
+ baseUrl: "<%= spree.api_taxons_path %>",
17
+ query_params: <%== spree_taxon_editor.settings[:query_params].to_json %>,
18
+ <% if spree_taxon_editor.taxon %>
19
+ initialSelection: {
20
+ id: <%= spree_taxon_editor.taxon.id %>,
21
+ text: "<%= spree_taxon_editor.taxon.pretty_name %>"
22
+ }
23
+ <% end %>
24
+ })
25
+ </script>
@@ -0,0 +1 @@
1
+ <%= spree_taxon_view.taxon&.name %>
@@ -0,0 +1,25 @@
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
+ <%= f.text_field :variant_id,
7
+ value: spree_variant_editor.variant&.id,
8
+ class: 'alchemy_selectbox full_width' %>
9
+ <% end %>
10
+ <% end %>
11
+
12
+ <script>
13
+ $('#<%= spree_variant_editor.form_field_id(:variant_id) %>').alchemyVariantSelect({
14
+ placeholder: "<%= Alchemy.t(:search_variant, scope: 'solidus') %>",
15
+ apiToken: "<%= current_alchemy_user.spree_api_key %>",
16
+ baseUrl: "<%= spree.api_variants_path %>",
17
+ query_params: <%== spree_variant_editor.settings[:query_params].to_json %>,
18
+ <% if spree_variant_editor.variant %>
19
+ initialSelection: {
20
+ id: <%= spree_variant_editor.variant.id %>,
21
+ text: "<%= spree_variant_editor.variant.name %>"
22
+ }
23
+ <% end %>
24
+ })
25
+ </script>
@@ -0,0 +1 @@
1
+ <%= spree_variant_view.variant&.name %>
@@ -2,7 +2,7 @@ alchemy_module = {
2
2
  engine_name: 'spree',
3
3
  name: 'solidus',
4
4
  navigation: {
5
- controller: 'spree/admin/orders',
5
+ controller: '/spree/admin/orders',
6
6
  action: 'index',
7
7
  name: 'Store',
8
8
  inline_image: '<svg version="1.1" width="24px" height="24px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" style="vertical-align: middle">
@@ -11,22 +11,22 @@ alchemy_module = {
11
11
  data: { turbolinks: false },
12
12
  sub_navigation: [
13
13
  {
14
- controller: 'spree/admin/orders',
14
+ controller: '/spree/admin/orders',
15
15
  action: 'index',
16
16
  name: 'Orders'
17
17
  },
18
18
  {
19
- controller: 'spree/admin/products',
19
+ controller: '/spree/admin/products',
20
20
  action: 'index',
21
21
  name: 'Products'
22
22
  },
23
23
  {
24
- controller: 'spree/admin/promotions',
24
+ controller: '/spree/admin/promotions',
25
25
  action: 'index',
26
26
  name: 'Promotions'
27
27
  },
28
28
  {
29
- controller: 'spree/admin/stock_items',
29
+ controller: '/spree/admin/stock_items',
30
30
  action: 'index',
31
31
  name: 'Stock'
32
32
  }
@@ -37,7 +37,7 @@ alchemy_module = {
37
37
  if defined?(Spree::Auth::Engine)
38
38
  alchemy_module[:navigation][:sub_navigation].push(
39
39
  {
40
- controller: 'spree/admin/users',
40
+ controller: '/spree/admin/users',
41
41
  action: 'index',
42
42
  name: 'Users'
43
43
  }
@@ -52,4 +52,6 @@ if defined?(Spree::Auth::Engine)
52
52
  end
53
53
  end
54
54
 
55
- Alchemy::Modules.register_module(alchemy_module)
55
+ Rails.application.config.after_initialize do
56
+ Alchemy::Modules.register_module(alchemy_module)
57
+ end
@@ -12,18 +12,18 @@ module Alchemy
12
12
  Alchemy.register_ability ::Spree::Ability
13
13
  ::Spree::Ability.register_ability ::Alchemy::Permissions
14
14
 
15
- if Alchemy.user_class.name == 'Spree::User'
15
+ if Alchemy.user_class_name == '::Spree::User'
16
16
  require 'alchemy/solidus/spree_user_extension'
17
17
  Spree::User.include Alchemy::Solidus::SpreeUserExtension
18
18
  end
19
19
 
20
- if Alchemy.user_class.name == 'Alchemy::User'
20
+ if Alchemy.user_class_name == '::Alchemy::User'
21
21
  require 'alchemy/solidus/alchemy_user_extension'
22
22
  Alchemy::User.include Alchemy::Solidus::AlchemyUserExtension
23
23
  require 'alchemy/solidus/spree_admin_unauthorized_redirect'
24
24
  end
25
25
 
26
- if SolidusSupport.solidus_gem_version < Gem::Version.new('2.5')
26
+ if Spree.solidus_gem_version < Gem::Version.new('2.5')
27
27
  require 'alchemy/solidus/spree_custom_user_generator_fix'
28
28
  require 'alchemy/solidus/spree_install_generator_fix'
29
29
  end
@@ -40,7 +40,7 @@ module Alchemy
40
40
  # Fix for +belongs_to :bill_address+ in {Spree::UserAddressBook}
41
41
  # Solidus has this set to +false+ in {Spree::Base}, but {Alchemy::User} does not inherit from it.
42
42
  initializer 'alchemy_solidus.belongs_bill_address_fix' do
43
- if Alchemy.user_class.name == 'Alchemy::User'
43
+ if Alchemy.user_class_name == '::Alchemy::User'
44
44
  ActiveSupport.on_load(:active_record) do
45
45
  Alchemy::User.belongs_to_required_by_default = false
46
46
  end
@@ -1,6 +1,10 @@
1
1
  module Alchemy
2
2
  module Solidus
3
3
  module SpreeUserExtension
4
+ def self.included(klass)
5
+ klass.has_many :folded_pages, class_name: "Alchemy::FoldedPage"
6
+ end
7
+
4
8
  def alchemy_roles
5
9
  if has_spree_role?(:admin)
6
10
  %w(admin)
@@ -1,5 +1,5 @@
1
1
  module Alchemy
2
2
  module Solidus
3
- VERSION = "3.1.1"
3
+ VERSION = "4.0.0-b1"
4
4
  end
5
5
  end
@@ -36,7 +36,7 @@ module Alchemy
36
36
 
37
37
  def run_alchemy_installer
38
38
  unless options[:skip_alchemy_installer]
39
- arguments = options[:auto_accept] ? ['--skip-demo-files', '--force'] : []
39
+ arguments = options[:auto_accept] ? ['--skip-demo-files', '--force', '--auto-accept'] : []
40
40
  Alchemy::Generators::InstallGenerator.start(arguments)
41
41
  rake('railties:install:migrations', abort_on_failure: true)
42
42
  rake('db:migrate', abort_on_failure: true)
@@ -55,7 +55,7 @@ module Alchemy
55
55
  arguments = options[:auto_accept] ? ['Alchemy::User', '--force'] : ['Alchemy::User']
56
56
  Spree::CustomUserGenerator.start(arguments)
57
57
  gsub_file 'lib/spree/authentication_helpers.rb', /main_app\./, 'Alchemy.'
58
- if SolidusSupport.solidus_gem_version < Gem::Version.new('2.5.0')
58
+ if Spree.solidus_gem_version < Gem::Version.new('2.5.0')
59
59
  gsub_file 'config/initializers/spree.rb', /Spree\.user_class.?=.?.+$/, 'Spree.user_class = "Alchemy::User"'
60
60
  end
61
61
  rake('db:migrate', abort_on_failure: true)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy-solidus
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 4.0.0.pre.b1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-11 00:00:00.000000000 Z
11
+ date: 2021-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: alchemy_cms
@@ -16,27 +16,27 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.1.0
19
+ version: 5.0.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '5.0'
22
+ version: '6.1'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 4.1.0
29
+ version: 5.0.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '5.0'
32
+ version: '6.1'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: solidus_core
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: 2.6.0
39
+ version: 2.10.0
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
42
  version: '3.0'
@@ -46,7 +46,7 @@ dependencies:
46
46
  requirements:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 2.6.0
49
+ version: 2.10.0
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
52
  version: '3.0'
@@ -56,7 +56,7 @@ dependencies:
56
56
  requirements:
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: 2.6.0
59
+ version: 2.10.0
60
60
  - - "<"
61
61
  - !ruby/object:Gem::Version
62
62
  version: '3.0'
@@ -66,7 +66,7 @@ dependencies:
66
66
  requirements:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: 2.6.0
69
+ version: 2.10.0
70
70
  - - "<"
71
71
  - !ruby/object:Gem::Version
72
72
  version: '3.0'
@@ -214,12 +214,21 @@ files:
214
214
  - app/models/alchemy/essence_spree_product.rb
215
215
  - app/models/alchemy/essence_spree_taxon.rb
216
216
  - app/models/alchemy/essence_spree_variant.rb
217
+ - app/models/alchemy/ingredients/spree_product.rb
218
+ - app/models/alchemy/ingredients/spree_taxon.rb
219
+ - app/models/alchemy/ingredients/spree_variant.rb
217
220
  - app/views/alchemy/essences/_essence_spree_product_editor.html.erb
218
221
  - app/views/alchemy/essences/_essence_spree_product_view.html.erb
219
222
  - app/views/alchemy/essences/_essence_spree_taxon_editor.html.erb
220
223
  - app/views/alchemy/essences/_essence_spree_taxon_view.html.erb
221
224
  - app/views/alchemy/essences/_essence_spree_variant_editor.html.erb
222
225
  - app/views/alchemy/essences/_essence_spree_variant_view.html.erb
226
+ - app/views/alchemy/ingredients/_spree_product_editor.html.erb
227
+ - app/views/alchemy/ingredients/_spree_product_view.html.erb
228
+ - app/views/alchemy/ingredients/_spree_taxon_editor.html.erb
229
+ - app/views/alchemy/ingredients/_spree_taxon_view.html.erb
230
+ - app/views/alchemy/ingredients/_spree_variant_editor.html.erb
231
+ - app/views/alchemy/ingredients/_spree_variant_view.html.erb
223
232
  - app/views/spree/admin/shared/_alchemy_sub_menu.html.erb
224
233
  - config/initializers/alchemy.rb
225
234
  - config/initializers/solidus.rb
@@ -257,11 +266,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
257
266
  version: '0'
258
267
  required_rubygems_version: !ruby/object:Gem::Requirement
259
268
  requirements:
260
- - - ">="
269
+ - - ">"
261
270
  - !ruby/object:Gem::Version
262
- version: '0'
271
+ version: 1.3.1
263
272
  requirements: []
264
- rubygems_version: 3.0.3
273
+ rubygems_version: 3.1.4
265
274
  signing_key:
266
275
  specification_version: 4
267
276
  summary: The World's Most Flexible E-Commerce Platform meets The World's Most Flexible