alchemy-solidus 8.1.0 → 8.4.1
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/Rakefile +2 -2
- data/app/components/alchemy/admin/product_select.rb +2 -1
- data/app/components/alchemy/admin/variant_select.rb +2 -1
- data/app/javascript/alchemy_solidus/components/product_select.js +19 -12
- data/app/javascript/alchemy_solidus/components/taxon_select.js +16 -12
- data/app/javascript/alchemy_solidus/components/variant_select.js +28 -28
- data/app/jobs/alchemy/solidus/invalidate_elements_cache_job.rb +5 -0
- data/app/overrides/spree/admin/users/_form/alchemy_roles_field.html.erb.deface +10 -0
- data/app/patches/controllers/alchemy/solidus/spree_admin_users_controller_patch.rb +19 -0
- data/app/patches/models/alchemy/solidus/alchemy_user_patch.rb +1 -1
- data/app/patches/models/alchemy/solidus/spree_product_patch.rb +2 -8
- data/app/patches/models/alchemy/solidus/spree_taxon_patch.rb +1 -10
- data/app/patches/models/alchemy/solidus/spree_user_patch.rb +1 -8
- data/app/patches/models/alchemy/solidus/spree_variant_patch.rb +2 -10
- data/config/locales/alchemy_solidus.de.yml +13 -0
- data/config/locales/alchemy_solidus.en.yml +33 -0
- data/config/locales/alchemy_solidus.it.yml +24 -0
- data/lib/alchemy/solidus/test_support/factories/ingredient_factories.rb +13 -0
- data/lib/alchemy/solidus/version.rb +1 -1
- data/lib/generators/alchemy/solidus/install/files/db/migrate/set_alchemy_roles.tt +16 -0
- data/lib/generators/alchemy/solidus/install/install_generator.rb +23 -0
- metadata +12 -9
- data/config/locales/alchemy_solidus_en.yml +0 -20
- data/config/locales/alchemy_solidus_it.yml +0 -11
- data/config/locales/en.yml +0 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 388e43431448c1a1a17fa17d35cd664791e29cb0ce0347d0305eade52beee9f2
|
|
4
|
+
data.tar.gz: 0a3898bfe1729d1493192d7afc18ce9a1fd49b08a3bc104b50d1a1495ef8d903
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 38f6dda602d371891230ea523e3de04ab5175c61e35777f29383799f8271bdf3df771f77853f2c7b17d2a520d215609fa3c3138783a40e5e0cdfc8befdc8aff7
|
|
7
|
+
data.tar.gz: 0c9cfc91e7d5f2bb9c0d9f0819cdc042daea377876a465a759e962ae08148934250e5cab74609f98631b49e06301b0fc9f77dd11eec66b8e4eb110743f3b002e
|
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_branch = ENV.fetch("SOLIDUS_BRANCH", "v4.
|
|
17
|
+
solidus_branch = ENV.fetch("SOLIDUS_BRANCH", "v4.7")
|
|
18
18
|
solidus_install_options = "--payment-method=none --frontend=none --authentication=none"
|
|
19
|
-
if ["v4.5", "v4.6", "main"].include?(solidus_branch)
|
|
19
|
+
if ["v4.5", "v4.6", "v4.7", "main"].include?(solidus_branch)
|
|
20
20
|
solidus_install_options += " --admin-preview=false"
|
|
21
21
|
end
|
|
22
22
|
ENV["SKIP_SOLIDUS_BOLT"] = "1" # solidus_frontend defaults to installing solidus_bolt if auto-accept is used
|
|
@@ -15,7 +15,7 @@ export default class ProductSelect extends RemoteSelect {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* Parses server response into
|
|
18
|
+
* Parses server response into a results object
|
|
19
19
|
* @param {object} response
|
|
20
20
|
* @returns {object}
|
|
21
21
|
* @private
|
|
@@ -26,6 +26,7 @@ export default class ProductSelect extends RemoteSelect {
|
|
|
26
26
|
return {
|
|
27
27
|
id: this._parsedValue(product),
|
|
28
28
|
name: product.name,
|
|
29
|
+
image: product.master?.images[0]?.mini_url,
|
|
29
30
|
}
|
|
30
31
|
}),
|
|
31
32
|
more: response.current_page * response.per_page < response.total_count,
|
|
@@ -48,24 +49,30 @@ export default class ProductSelect extends RemoteSelect {
|
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
/**
|
|
51
|
-
*
|
|
52
|
+
* slots of a dropdown option
|
|
52
53
|
* @param {object} product
|
|
53
|
-
* @
|
|
54
|
-
* @
|
|
54
|
+
* @param {string} term
|
|
55
|
+
* @returns {object}
|
|
56
|
+
* @protected
|
|
55
57
|
*/
|
|
56
|
-
|
|
57
|
-
return
|
|
58
|
+
_entry(product, term) {
|
|
59
|
+
return {
|
|
60
|
+
primary: this._hightlightTerm(product.name, term),
|
|
61
|
+
media: product.image
|
|
62
|
+
}
|
|
58
63
|
}
|
|
59
64
|
|
|
60
65
|
/**
|
|
61
|
-
*
|
|
66
|
+
* slots of the selected product shown in the control
|
|
62
67
|
* @param {object} product
|
|
63
|
-
* @
|
|
64
|
-
* @
|
|
65
|
-
* @private
|
|
68
|
+
* @returns {object}
|
|
69
|
+
* @protected
|
|
66
70
|
*/
|
|
67
|
-
|
|
68
|
-
return
|
|
71
|
+
_selectedEntry(product) {
|
|
72
|
+
return {
|
|
73
|
+
primary: product.name,
|
|
74
|
+
media: product.image
|
|
75
|
+
}
|
|
69
76
|
}
|
|
70
77
|
}
|
|
71
78
|
|
|
@@ -11,7 +11,7 @@ export default class TaxonSelect extends RemoteSelect {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* Parses server response into
|
|
14
|
+
* Parses server response into a results object
|
|
15
15
|
* @param {object} response
|
|
16
16
|
* @returns {object}
|
|
17
17
|
* @private
|
|
@@ -24,24 +24,28 @@ export default class TaxonSelect extends RemoteSelect {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* slots of a dropdown option
|
|
28
28
|
* @param {object} taxon
|
|
29
|
-
* @
|
|
30
|
-
* @
|
|
29
|
+
* @param {string} term
|
|
30
|
+
* @returns {object}
|
|
31
|
+
* @protected
|
|
31
32
|
*/
|
|
32
|
-
|
|
33
|
-
return
|
|
33
|
+
_entry(taxon, term) {
|
|
34
|
+
return {
|
|
35
|
+
primary: this._hightlightTerm(taxon.pretty_name, term)
|
|
36
|
+
}
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
/**
|
|
37
|
-
*
|
|
40
|
+
* slots of the selected taxon shown in the control
|
|
38
41
|
* @param {object} taxon
|
|
39
|
-
* @
|
|
40
|
-
* @
|
|
41
|
-
* @private
|
|
42
|
+
* @returns {object}
|
|
43
|
+
* @protected
|
|
42
44
|
*/
|
|
43
|
-
|
|
44
|
-
return
|
|
45
|
+
_selectedEntry(taxon) {
|
|
46
|
+
return {
|
|
47
|
+
primary: taxon.text || taxon.pretty_name
|
|
48
|
+
}
|
|
45
49
|
}
|
|
46
50
|
}
|
|
47
51
|
|
|
@@ -11,7 +11,7 @@ export default class VariantSelect extends RemoteSelect {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* Search query send to server
|
|
14
|
+
* Search query send to server
|
|
15
15
|
* @param {string} term
|
|
16
16
|
* @param {number} page
|
|
17
17
|
* @returns {object}
|
|
@@ -28,51 +28,51 @@ export default class VariantSelect extends RemoteSelect {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
* Parses server response into
|
|
31
|
+
* Parses server response into a results object
|
|
32
32
|
* @param {object} response
|
|
33
33
|
* @returns {object}
|
|
34
34
|
* @private
|
|
35
35
|
*/
|
|
36
36
|
_parseResponse(response) {
|
|
37
37
|
return {
|
|
38
|
-
results: response.variants
|
|
38
|
+
results: response.variants.map((variant) => {
|
|
39
|
+
return {
|
|
40
|
+
...variant,
|
|
41
|
+
image: variant.images[0]?.mini_url
|
|
42
|
+
}
|
|
43
|
+
}),
|
|
39
44
|
more: response.current_page * response.per_page < response.total_count,
|
|
40
45
|
}
|
|
41
46
|
}
|
|
42
47
|
|
|
43
48
|
/**
|
|
44
|
-
*
|
|
49
|
+
* slots of a dropdown option
|
|
45
50
|
* @param {object} variant
|
|
46
|
-
* @
|
|
47
|
-
* @
|
|
51
|
+
* @param {string} term
|
|
52
|
+
* @returns {object}
|
|
53
|
+
* @protected
|
|
48
54
|
*/
|
|
49
|
-
|
|
50
|
-
return
|
|
51
|
-
|
|
52
|
-
: variant.
|
|
55
|
+
_entry(variant, term) {
|
|
56
|
+
return {
|
|
57
|
+
primary: this._hightlightTerm(variant.name, term),
|
|
58
|
+
secondary: variant.options_text,
|
|
59
|
+
secondaryAside: variant.sku,
|
|
60
|
+
media: variant.image
|
|
61
|
+
}
|
|
53
62
|
}
|
|
54
63
|
|
|
55
64
|
/**
|
|
56
|
-
*
|
|
65
|
+
* slots of the selected variant shown in the control
|
|
57
66
|
* @param {object} variant
|
|
58
|
-
* @
|
|
59
|
-
* @
|
|
60
|
-
* @private
|
|
67
|
+
* @returns {object}
|
|
68
|
+
* @protected
|
|
61
69
|
*/
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
<span>${name}</span>
|
|
69
|
-
</div>
|
|
70
|
-
<div>
|
|
71
|
-
<span>${variant.options_text}</span>
|
|
72
|
-
<span>${sku}</span>
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
75
|
-
`
|
|
70
|
+
_selectedEntry(variant) {
|
|
71
|
+
return {
|
|
72
|
+
primary: variant.name,
|
|
73
|
+
secondary: variant.options_text,
|
|
74
|
+
media: variant.image
|
|
75
|
+
}
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -4,6 +4,11 @@ module Alchemy
|
|
|
4
4
|
queue_as :default
|
|
5
5
|
|
|
6
6
|
def perform(model_name, id)
|
|
7
|
+
Alchemy::Deprecation.warn <<~WARN
|
|
8
|
+
Alchemy::Solidus::InvalidateElementsCacheJob is deprecated and will be removed in 9.0.
|
|
9
|
+
Please use Alchemy::InvalidateElementsCacheJob instead.
|
|
10
|
+
WARN
|
|
11
|
+
|
|
7
12
|
now = Time.current
|
|
8
13
|
|
|
9
14
|
element_ids = model(model_name)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<!-- insert_after '[data-hook="admin_user_form_roles"]' -->
|
|
2
|
+
|
|
3
|
+
<%= f.field_container :alchemy_roles do %>
|
|
4
|
+
<%= label_tag nil, t(".alchemy_roles") %>
|
|
5
|
+
<%= admin_hint t(".alchemy_roles"), t(:alchemy_roles_html, scope: [:spree, :hints, "spree/user"]) %>
|
|
6
|
+
<%= f.collection_select :alchemy_roles, Alchemy.config.user_roles, :to_s, :capitalize,
|
|
7
|
+
{include_blank: false},
|
|
8
|
+
multiple: true, disabled: cannot?(:update_role, @user),
|
|
9
|
+
class: "select2 fullwidth" %>
|
|
10
|
+
<% end %>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Alchemy
|
|
4
|
+
module Solidus
|
|
5
|
+
module SpreeAdminUsersControllerPatch
|
|
6
|
+
private
|
|
7
|
+
|
|
8
|
+
def permitted_user_attributes
|
|
9
|
+
attributes = super
|
|
10
|
+
attributes << {alchemy_roles: []} if can?(:update_role, @user)
|
|
11
|
+
attributes
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
if defined?(::Spree::Admin::UsersController)
|
|
15
|
+
::Spree::Admin::UsersController.prepend self
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -4,8 +4,6 @@ module Alchemy
|
|
|
4
4
|
module Solidus
|
|
5
5
|
module SpreeProductPatch
|
|
6
6
|
def self.prepended(base)
|
|
7
|
-
# Solidus runs touch callbacks on product after_save
|
|
8
|
-
base.after_touch :touch_alchemy_ingredients
|
|
9
7
|
base.has_many :alchemy_ingredients, class_name: "Alchemy::Ingredients::SpreeProduct", as: :related_object, dependent: :nullify
|
|
10
8
|
end
|
|
11
9
|
|
|
@@ -24,13 +22,9 @@ module Alchemy
|
|
|
24
22
|
taxons.each(&:touch)
|
|
25
23
|
end
|
|
26
24
|
|
|
27
|
-
# Touch all elements that have this product assigned to one of its ingredients.
|
|
28
|
-
# This cascades to all parent elements and pages as well.
|
|
29
|
-
def touch_alchemy_ingredients
|
|
30
|
-
InvalidateElementsCacheJob.perform_later("SpreeProduct", id)
|
|
31
|
-
end
|
|
32
|
-
|
|
33
25
|
::Spree::Product.prepend self
|
|
34
26
|
end
|
|
35
27
|
end
|
|
28
|
+
|
|
29
|
+
::Spree::Product.include RelatableResource
|
|
36
30
|
end
|
|
@@ -4,20 +4,11 @@ module Alchemy
|
|
|
4
4
|
module Solidus
|
|
5
5
|
module SpreeTaxonPatch
|
|
6
6
|
def self.prepended(base)
|
|
7
|
-
base.after_update :touch_alchemy_ingredients
|
|
8
|
-
base.after_touch :touch_alchemy_ingredients
|
|
9
7
|
base.has_many :alchemy_ingredients, class_name: "Alchemy::Ingredients::SpreeTaxon", as: :related_object, dependent: :nullify
|
|
10
8
|
end
|
|
11
9
|
|
|
12
10
|
::Spree::Taxon.prepend self
|
|
13
|
-
|
|
14
|
-
private
|
|
15
|
-
|
|
16
|
-
# Touch all elements that have this taxon assigned to one of its ingredients.
|
|
17
|
-
# This cascades to all parent elements and pages as well.
|
|
18
|
-
def touch_alchemy_ingredients
|
|
19
|
-
InvalidateElementsCacheJob.perform_later("SpreeTaxon", id)
|
|
20
|
-
end
|
|
21
11
|
end
|
|
22
12
|
end
|
|
13
|
+
::Spree::Taxon.include RelatableResource
|
|
23
14
|
end
|
|
@@ -11,16 +11,9 @@ module Alchemy
|
|
|
11
11
|
email
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
def alchemy_roles
|
|
15
|
-
if has_spree_role?(:admin)
|
|
16
|
-
%w[admin]
|
|
17
|
-
else
|
|
18
|
-
[]
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
14
|
if defined?(::Spree::User)
|
|
23
15
|
::Spree::User.prepend self
|
|
16
|
+
::Spree::User.include Alchemy::UserMethods
|
|
24
17
|
end
|
|
25
18
|
end
|
|
26
19
|
end
|
|
@@ -4,20 +4,12 @@ module Alchemy
|
|
|
4
4
|
module Solidus
|
|
5
5
|
module SpreeVariantPatch
|
|
6
6
|
def self.prepended(base)
|
|
7
|
-
base.after_update :touch_alchemy_ingredients
|
|
8
|
-
base.after_touch :touch_alchemy_ingredients
|
|
9
7
|
base.has_many :alchemy_ingredients, class_name: "Alchemy::Ingredients::SpreeVariant", as: :related_object, dependent: :nullify
|
|
10
8
|
end
|
|
11
9
|
|
|
12
10
|
::Spree::Variant.prepend self
|
|
13
|
-
|
|
14
|
-
private
|
|
15
|
-
|
|
16
|
-
# Touch all elements that have this variant assigned to one of its ingredients.
|
|
17
|
-
# This cascades to all parent elements and pages as well.
|
|
18
|
-
def touch_alchemy_ingredients
|
|
19
|
-
InvalidateElementsCacheJob.perform_later("SpreeVariant", id)
|
|
20
|
-
end
|
|
21
11
|
end
|
|
22
12
|
end
|
|
13
|
+
|
|
14
|
+
::Spree::Variant.include RelatableResource
|
|
23
15
|
end
|
|
@@ -18,3 +18,16 @@ de:
|
|
|
18
18
|
users: Benutzer
|
|
19
19
|
pictures: Bilder
|
|
20
20
|
attachments: Dateien
|
|
21
|
+
users:
|
|
22
|
+
form:
|
|
23
|
+
alchemy_roles: Alchemy Rollen
|
|
24
|
+
hints:
|
|
25
|
+
spree/user:
|
|
26
|
+
alchemy_roles_html: |
|
|
27
|
+
<p>Diese Rollen steuern den Zugriff zum Alchemy CMS.</p>
|
|
28
|
+
<ul>
|
|
29
|
+
<li><kbd>Mitglied</kbd> beschreibt regulär angemeldete Kunden und ermöglicht den Zugriff auf regulär gesicherte Seiten. Sie <strong>ermöglicht nicht</strong> auf den Admin Bereich zuzugreifen.</li>
|
|
30
|
+
<li><kbd>Autor</kbd> ermöglicht Seiteninhalte zu bearbeiten, aber keine Seiten zu erstellen.</li>
|
|
31
|
+
<li><kbd>Editor</kbd> ermöglicht vollen Zugriff auf Seiten und Sprachen.</li>
|
|
32
|
+
<li><kbd>Admin</kbd> ermöglicht <strong>vollen Zugriff auf alles</strong>.</li>
|
|
33
|
+
</ul>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
en:
|
|
2
|
+
alchemy:
|
|
3
|
+
choose_product_to_link: Choose a product to link to
|
|
4
|
+
link_overlay_tab_label:
|
|
5
|
+
product: Product
|
|
6
|
+
solidus:
|
|
7
|
+
search_variant: Search a variant by name or sku
|
|
8
|
+
search_product: Search a product by name
|
|
9
|
+
search_taxon: Search a taxon by name
|
|
10
|
+
spree:
|
|
11
|
+
admin:
|
|
12
|
+
tab:
|
|
13
|
+
cms: CMS
|
|
14
|
+
pages: Pages
|
|
15
|
+
sites: Sites
|
|
16
|
+
languages: Languages
|
|
17
|
+
tags: Tags
|
|
18
|
+
users: Users
|
|
19
|
+
pictures: Pictures
|
|
20
|
+
attachments: Attachments
|
|
21
|
+
users:
|
|
22
|
+
form:
|
|
23
|
+
alchemy_roles: Alchemy Roles
|
|
24
|
+
hints:
|
|
25
|
+
spree/user:
|
|
26
|
+
alchemy_roles_html: |
|
|
27
|
+
<p>These roles allow access to Alchemy CMS.</p>
|
|
28
|
+
<ul>
|
|
29
|
+
<li><kbd>Member</kbd> describes regular logged in customers and allows to visit regularly restricted pages. It <strong>does not</strong> grant access to the CMS backend.</li>
|
|
30
|
+
<li><kbd>Author</kbd> grants access to edit content but not to create pages.</li>
|
|
31
|
+
<li><kbd>Editor</kbd> grants access to fully manage pages and languages.</li>
|
|
32
|
+
<li><kbd>Admin</kbd> grants access <strong>to manage everything</strong>.</li>
|
|
33
|
+
</ul>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
it:
|
|
2
|
+
spree:
|
|
3
|
+
admin:
|
|
4
|
+
tab:
|
|
5
|
+
cms: CMS
|
|
6
|
+
pages: "Pagine"
|
|
7
|
+
sites: "Siti"
|
|
8
|
+
languages: "Lingue"
|
|
9
|
+
tags: "Tags"
|
|
10
|
+
pictures: "Immagini"
|
|
11
|
+
attachments: "File"
|
|
12
|
+
users:
|
|
13
|
+
form:
|
|
14
|
+
alchemy_roles: Alchemy Ruoli
|
|
15
|
+
hints:
|
|
16
|
+
spree/user:
|
|
17
|
+
alchemy_roles_html: |
|
|
18
|
+
<p>Questi ruoli consentono l'accesso ad Alchemy CMS.</p>
|
|
19
|
+
<ul>
|
|
20
|
+
<li><kbd>Membro</kbd> indica i normali clienti autenticati e consente di visitare le pagine ad accesso limitato. <strong>Non</strong> concede l'accesso al backend del CMS.</li>
|
|
21
|
+
<li><kbd>Autore</kbd> concede l'accesso alla modifica dei contenuti, ma non alla creazione di pagine.</li>
|
|
22
|
+
<li><kbd>Editore</kbd> concede l'accesso alla gestione completa di pagine e lingue.</li>
|
|
23
|
+
<li><kbd>Amministratore</kbd> concede l'accesso <strong>alla gestione di tutto</strong>.</li>
|
|
24
|
+
</ul>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
FactoryBot.define do
|
|
2
|
+
%w[
|
|
3
|
+
product
|
|
4
|
+
taxon
|
|
5
|
+
variant
|
|
6
|
+
].each do |ingredient|
|
|
7
|
+
factory :"alchemy_ingredient_spree_#{ingredient}", class: "Alchemy::Ingredients::Spree#{ingredient.classify}" do
|
|
8
|
+
role { ingredient }
|
|
9
|
+
type { "Alchemy::Ingredients::Spree#{ingredient.classify}" }
|
|
10
|
+
association :element, name: ingredient, factory: :alchemy_element
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
class SetAlchemyRolesOn<%= @table_name.camelcase %>Table < ActiveRecord::Migration[7.2]
|
|
2
|
+
def up
|
|
3
|
+
Spree::User.find_each do |user|
|
|
4
|
+
alchemy_roles = if user.has_spree_role?(:admin)
|
|
5
|
+
"admin"
|
|
6
|
+
end
|
|
7
|
+
user.update_column(:alchemy_roles, alchemy_roles)
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def down
|
|
12
|
+
Spree::User.find_each do |user|
|
|
13
|
+
user.update_column(:alchemy_roles, nil)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
require "rails/generators"
|
|
2
|
+
require "rails/generators/active_record/migration"
|
|
2
3
|
require "generators/alchemy/install/install_generator"
|
|
4
|
+
require "generators/alchemy/user_columns_migration/user_columns_migration_generator"
|
|
3
5
|
require "generators/spree/custom_user/custom_user_generator"
|
|
4
6
|
require "solidus_support"
|
|
5
7
|
|
|
@@ -11,6 +13,8 @@ end
|
|
|
11
13
|
module Alchemy
|
|
12
14
|
module Solidus
|
|
13
15
|
class InstallGenerator < Rails::Generators::Base
|
|
16
|
+
include ActiveRecord::Generators::Migration
|
|
17
|
+
|
|
14
18
|
SPREE_MOUNT_REGEXP = /mount\sSpree::Core::Engine.*$/
|
|
15
19
|
desc "Installs Alchemy Solidus into your App."
|
|
16
20
|
|
|
@@ -24,6 +28,11 @@ module Alchemy
|
|
|
24
28
|
type: :boolean,
|
|
25
29
|
desc:
|
|
26
30
|
"Set true if you don't want to run the Alchemy Devise installer. NOTE: Automatically skipped if Alchemy::Devise is not available."
|
|
31
|
+
class_option :skip_alchemy_user_columns_generator,
|
|
32
|
+
default: false,
|
|
33
|
+
type: :boolean,
|
|
34
|
+
desc:
|
|
35
|
+
"Set true if you don't want to run the Alchemy user columns generator. NOTE: Automatically skipped if Spree::User is not available."
|
|
27
36
|
class_option :skip_spree_custom_user_generator,
|
|
28
37
|
default: false,
|
|
29
38
|
type: :boolean,
|
|
@@ -64,6 +73,20 @@ module Alchemy
|
|
|
64
73
|
end
|
|
65
74
|
end
|
|
66
75
|
|
|
76
|
+
def run_alchemy_user_columns_generator
|
|
77
|
+
if defined?(::Spree::User) &&
|
|
78
|
+
!options[:skip_alchemy_user_columns_generator]
|
|
79
|
+
@table_name = ::Spree::User.table_name
|
|
80
|
+
arguments = [
|
|
81
|
+
"--table-name",
|
|
82
|
+
@table_name, options[:auto_accept] && "--force"
|
|
83
|
+
].compact
|
|
84
|
+
Alchemy::Generators::UserColumnsMigrationGenerator.start(arguments)
|
|
85
|
+
migration_template "db/migrate/set_alchemy_roles.tt", "db/migrate/set_alchemy_roles_on_#{@table_name}_table.rb"
|
|
86
|
+
rake("db:migrate", abort_on_failure: true)
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
67
90
|
def run_spree_custom_user_generator
|
|
68
91
|
if alchemy_devise_present? &&
|
|
69
92
|
!options[:skip_spree_custom_user_generator]
|
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.1
|
|
4
|
+
version: 8.4.1
|
|
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.
|
|
18
|
+
version: 8.4.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.
|
|
28
|
+
version: 8.4.0.a
|
|
29
29
|
- - "<"
|
|
30
30
|
- !ruby/object:Gem::Version
|
|
31
31
|
version: '9'
|
|
@@ -241,14 +241,14 @@ dependencies:
|
|
|
241
241
|
requirements:
|
|
242
242
|
- - "~>"
|
|
243
243
|
- !ruby/object:Gem::Version
|
|
244
|
-
version: '
|
|
244
|
+
version: '8.0'
|
|
245
245
|
type: :development
|
|
246
246
|
prerelease: false
|
|
247
247
|
version_requirements: !ruby/object:Gem::Requirement
|
|
248
248
|
requirements:
|
|
249
249
|
- - "~>"
|
|
250
250
|
- !ruby/object:Gem::Version
|
|
251
|
-
version: '
|
|
251
|
+
version: '8.0'
|
|
252
252
|
description: A AlchemyCMS and Solidus integration
|
|
253
253
|
email:
|
|
254
254
|
- thomas@vondeyen.com
|
|
@@ -284,8 +284,10 @@ files:
|
|
|
284
284
|
- app/overrides/alchemy/admin/pages/link/product_link_panel.html.erb.deface
|
|
285
285
|
- app/overrides/alchemy/admin/pages/link/product_link_sl_tab.html.erb.deface
|
|
286
286
|
- app/overrides/alchemy/admin/pages/link/product_link_tab.html.erb.deface
|
|
287
|
+
- app/overrides/spree/admin/users/_form/alchemy_roles_field.html.erb.deface
|
|
287
288
|
- app/patches/controllers/alchemy/solidus/alchemy_base_controller_patch.rb
|
|
288
289
|
- app/patches/controllers/alchemy/solidus/application_controller_patch.rb
|
|
290
|
+
- app/patches/controllers/alchemy/solidus/spree_admin_users_controller_patch.rb
|
|
289
291
|
- app/patches/controllers/alchemy/solidus/spree_user_confirmations_controller_patch.rb
|
|
290
292
|
- app/patches/controllers/alchemy/solidus/spree_user_passwords_controller_patch.rb
|
|
291
293
|
- app/patches/controllers/alchemy/solidus/spree_user_registrations_controller_patch.rb
|
|
@@ -301,12 +303,13 @@ files:
|
|
|
301
303
|
- config/initializers/alchemy.rb
|
|
302
304
|
- config/initializers/spree.rb
|
|
303
305
|
- config/locales/alchemy_solidus.de.yml
|
|
304
|
-
- config/locales/
|
|
305
|
-
- config/locales/
|
|
306
|
-
- config/locales/en.yml
|
|
306
|
+
- config/locales/alchemy_solidus.en.yml
|
|
307
|
+
- config/locales/alchemy_solidus.it.yml
|
|
307
308
|
- lib/alchemy-solidus.rb
|
|
308
309
|
- lib/alchemy/solidus/engine.rb
|
|
310
|
+
- lib/alchemy/solidus/test_support/factories/ingredient_factories.rb
|
|
309
311
|
- lib/alchemy/solidus/version.rb
|
|
312
|
+
- lib/generators/alchemy/solidus/install/files/db/migrate/set_alchemy_roles.tt
|
|
310
313
|
- lib/generators/alchemy/solidus/install/files/db/seeds/alchemy/pages.yml
|
|
311
314
|
- lib/generators/alchemy/solidus/install/install_generator.rb
|
|
312
315
|
- lib/patches/backend/controllers/alchemy/solidus/spree_admin_base_controller_patch.rb
|
|
@@ -329,7 +332,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
329
332
|
- !ruby/object:Gem::Version
|
|
330
333
|
version: '0'
|
|
331
334
|
requirements: []
|
|
332
|
-
rubygems_version: 4.0.
|
|
335
|
+
rubygems_version: 4.0.20
|
|
333
336
|
specification_version: 4
|
|
334
337
|
summary: The World's Most Flexible E-Commerce Platform meets The World's Most Flexible
|
|
335
338
|
Content Management System!
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
en:
|
|
2
|
-
alchemy:
|
|
3
|
-
choose_product_to_link: Choose a product to link to
|
|
4
|
-
link_overlay_tab_label:
|
|
5
|
-
product: Product
|
|
6
|
-
solidus:
|
|
7
|
-
search_variant: Search a variant by name or sku
|
|
8
|
-
search_product: Search a product by name
|
|
9
|
-
search_taxon: Search a taxon by name
|
|
10
|
-
spree:
|
|
11
|
-
admin:
|
|
12
|
-
tab:
|
|
13
|
-
cms: CMS
|
|
14
|
-
pages: Pages
|
|
15
|
-
sites: Sites
|
|
16
|
-
languages: Languages
|
|
17
|
-
tags: Tags
|
|
18
|
-
users: Users
|
|
19
|
-
pictures: Pictures
|
|
20
|
-
attachments: Attachments
|