alchemy-solidus 7.5.1 → 7.7.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 +4 -4
- data/README.md +0 -26
- data/app/components/alchemy/admin/link_dialog/product_tab.rb +2 -1
- data/app/components/alchemy/admin/product_select.rb +14 -4
- data/app/components/alchemy/admin/taxon_select.rb +46 -0
- data/app/components/alchemy/admin/variant_select.rb +48 -0
- data/app/javascript/alchemy_solidus/components/ajax_config.js +10 -0
- data/app/javascript/alchemy_solidus/components/product_select.js +56 -27
- data/app/javascript/alchemy_solidus/components/taxon_select.js +48 -0
- data/app/javascript/alchemy_solidus/components/variant_select.js +79 -0
- data/app/javascript/alchemy_solidus.js +2 -0
- data/app/jobs/alchemy/solidus/base_job.rb +7 -0
- data/app/jobs/alchemy/solidus/invalidate_elements_cache_job.rb +39 -0
- data/app/patches/controllers/alchemy/solidus/alchemy_base_controller_patch.rb +22 -0
- data/app/patches/controllers/alchemy/solidus/application_controller_patch.rb +19 -0
- data/app/patches/controllers/alchemy/solidus/spree_user_confirmations_controller_patch.rb +15 -0
- data/app/patches/controllers/alchemy/solidus/spree_user_passwords_controller_patch.rb +15 -0
- data/app/patches/controllers/alchemy/solidus/spree_user_registrations_controller_patch.rb +15 -0
- data/app/patches/controllers/alchemy/solidus/spree_user_sessions_controller_patch.rb +15 -0
- data/app/patches/helpers/alchemy/solidus/alchemy_base_helper_patch.rb +19 -0
- data/{lib/alchemy/solidus/alchemy_user_extension.rb → app/patches/models/alchemy/solidus/alchemy_user_patch.rb} +7 -3
- data/app/{decorators/models/alchemy/solidus/spree_product_decorator.rb → patches/models/alchemy/solidus/spree_product_patch.rb} +9 -2
- data/app/patches/models/alchemy/solidus/spree_taxon_patch.rb +23 -0
- data/app/patches/models/alchemy/solidus/spree_user_patch.rb +27 -0
- data/app/patches/models/alchemy/solidus/spree_variant_patch.rb +23 -0
- data/app/views/alchemy/ingredients/_spree_product_editor.html.erb +10 -21
- data/app/views/alchemy/ingredients/_spree_taxon_editor.html.erb +10 -21
- data/app/views/alchemy/ingredients/_spree_variant_editor.html.erb +10 -22
- data/config/initializers/alchemy.rb +20 -20
- data/config/initializers/spree.rb +7 -7
- data/lib/alchemy/solidus/engine.rb +17 -16
- data/lib/alchemy/solidus/version.rb +1 -1
- data/lib/generators/alchemy/solidus/install/install_generator.rb +32 -32
- data/lib/patches/backend/controllers/alchemy/solidus/spree_admin_base_controller_patch.rb +25 -0
- data/lib/patches/frontend/controllers/alchemy/solidus/spree_store_controller_patch.rb +17 -0
- metadata +26 -22
- data/app/decorators/models/alchemy/solidus/spree_taxon_decorator.rb +0 -14
- data/app/decorators/models/alchemy/solidus/spree_variant_decorator.rb +0 -14
- data/app/javascript/alchemy_solidus/product_select.js +0 -37
- data/app/javascript/alchemy_solidus/select2_config.js +0 -24
- data/app/javascript/alchemy_solidus/taxon_select.js +0 -37
- data/app/javascript/alchemy_solidus/variant_select.js +0 -55
- data/app/models/alchemy/solidus/touch_alchemy_ingredients.rb +0 -20
- data/db/migrate/20120229160509_create_alchemy_essence_spree_products.rb +0 -8
- data/db/migrate/20131030140218_create_alchemy_essence_spree_taxons.rb +0 -10
- data/db/migrate/20191107135822_create_alchemy_essence_spree_variants.rb +0 -9
- data/lib/alchemy/solidus/alchemy_in_solidus.rb +0 -17
- data/lib/alchemy/solidus/current_user_helpers.rb +0 -9
- data/lib/alchemy/solidus/spree_admin_unauthorized_redirect.rb +0 -9
- data/lib/alchemy/solidus/spree_user_extension.rb +0 -21
- data/lib/alchemy/solidus/use_solidus_layout.rb +0 -19
@@ -1,37 +0,0 @@
|
|
1
|
-
import { getSelect2Config } from "alchemy_solidus/select2_config"
|
2
|
-
|
3
|
-
$.fn.alchemyProductSelect = function (options) {
|
4
|
-
const config = getSelect2Config(options)
|
5
|
-
|
6
|
-
function formatResultObject(product) {
|
7
|
-
return {
|
8
|
-
id: product.id,
|
9
|
-
text: product.name,
|
10
|
-
}
|
11
|
-
}
|
12
|
-
|
13
|
-
const select2config = Object.assign(config, {
|
14
|
-
ajax: Object.assign(config.ajax, {
|
15
|
-
data(term, page) {
|
16
|
-
return {
|
17
|
-
q: Object.assign(
|
18
|
-
{
|
19
|
-
name_cont: term,
|
20
|
-
},
|
21
|
-
options.query_params
|
22
|
-
),
|
23
|
-
page: page,
|
24
|
-
}
|
25
|
-
},
|
26
|
-
results(data, page) {
|
27
|
-
return {
|
28
|
-
results: data.products.map(
|
29
|
-
options.formatResultObject || formatResultObject
|
30
|
-
),
|
31
|
-
more: page * data.per_page < data.total_count,
|
32
|
-
}
|
33
|
-
},
|
34
|
-
}),
|
35
|
-
})
|
36
|
-
this.select2(select2config)
|
37
|
-
}
|
@@ -1,24 +0,0 @@
|
|
1
|
-
export function getSelect2Config(options) {
|
2
|
-
const headers = {
|
3
|
-
Authorization: "Bearer " + options.apiToken,
|
4
|
-
}
|
5
|
-
|
6
|
-
return {
|
7
|
-
placeholder: options.placeholder,
|
8
|
-
minimumInputLength: 3,
|
9
|
-
allowClear: true,
|
10
|
-
initSelection:
|
11
|
-
options.initSelection ||
|
12
|
-
function (_$el, callback) {
|
13
|
-
if (options.initialSelection) {
|
14
|
-
callback(options.initialSelection)
|
15
|
-
}
|
16
|
-
},
|
17
|
-
ajax: {
|
18
|
-
url: options.baseUrl,
|
19
|
-
datatype: "json",
|
20
|
-
quietMillis: 300,
|
21
|
-
params: { headers: headers },
|
22
|
-
},
|
23
|
-
}
|
24
|
-
}
|
@@ -1,37 +0,0 @@
|
|
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,55 +0,0 @@
|
|
1
|
-
import { getSelect2Config } from "alchemy_solidus/select2_config"
|
2
|
-
|
3
|
-
$.fn.alchemyVariantSelect = function (options) {
|
4
|
-
const config = getSelect2Config(options)
|
5
|
-
|
6
|
-
function formatSelection(variant) {
|
7
|
-
return variant.options_text
|
8
|
-
? `${variant.name} - ${variant.options_text}`
|
9
|
-
: variant.name
|
10
|
-
}
|
11
|
-
|
12
|
-
function formatResult(variant, _el, query) {
|
13
|
-
const matchTerm = new RegExp(query.term, "gi")
|
14
|
-
const formatMatch = (match) => `<em>${match}</em>`
|
15
|
-
const name = variant.name.replace(matchTerm, formatMatch)
|
16
|
-
const sku = variant.sku.replace(matchTerm, formatMatch)
|
17
|
-
return `
|
18
|
-
<div class="variant-select-result">
|
19
|
-
<div>
|
20
|
-
<span>${name}</span>
|
21
|
-
</div>
|
22
|
-
<div>
|
23
|
-
<span>${variant.options_text}</span>
|
24
|
-
<span>${sku}</span>
|
25
|
-
</div>
|
26
|
-
</div>
|
27
|
-
`
|
28
|
-
}
|
29
|
-
|
30
|
-
this.select2(
|
31
|
-
$.extend(true, config, {
|
32
|
-
ajax: {
|
33
|
-
data(term, page) {
|
34
|
-
return {
|
35
|
-
q: $.extend(
|
36
|
-
{
|
37
|
-
product_name_or_sku_cont: term,
|
38
|
-
},
|
39
|
-
options.query_params
|
40
|
-
),
|
41
|
-
page: page,
|
42
|
-
}
|
43
|
-
},
|
44
|
-
results(data, page) {
|
45
|
-
return {
|
46
|
-
results: data.variants,
|
47
|
-
more: page * data.per_page < data.total_count,
|
48
|
-
}
|
49
|
-
},
|
50
|
-
},
|
51
|
-
formatSelection,
|
52
|
-
formatResult,
|
53
|
-
})
|
54
|
-
)
|
55
|
-
}
|
@@ -1,20 +0,0 @@
|
|
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
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# Allows to render Alchemy content within Solidus' controller views
|
2
|
-
Spree::StoreController.include(
|
3
|
-
Alchemy::ControllerActions,
|
4
|
-
Alchemy::ConfigurationMethods
|
5
|
-
)
|
6
|
-
|
7
|
-
# Hook into SolidusAuthDevise controllers if present
|
8
|
-
if defined? Spree::Auth::Engine
|
9
|
-
Spree::UserPasswordsController.include Alchemy::ControllerActions
|
10
|
-
Spree::UserConfirmationsController.include Alchemy::ControllerActions
|
11
|
-
Spree::UserRegistrationsController.include Alchemy::ControllerActions
|
12
|
-
Spree::UserSessionsController.include Alchemy::ControllerActions
|
13
|
-
end
|
14
|
-
|
15
|
-
# Do not prefix element view partials with `spree` namespace.
|
16
|
-
# See https://github.com/AlchemyCMS/alchemy_cms/issues/1626
|
17
|
-
ActionView::Base.prefix_partial_path_with_controller_namespace = false
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module Alchemy
|
2
|
-
module Solidus
|
3
|
-
module SpreeUserExtension
|
4
|
-
def self.included(klass)
|
5
|
-
klass.has_many :folded_pages, class_name: "Alchemy::FoldedPage"
|
6
|
-
end
|
7
|
-
|
8
|
-
def alchemy_display_name
|
9
|
-
email
|
10
|
-
end
|
11
|
-
|
12
|
-
def alchemy_roles
|
13
|
-
if has_spree_role?(:admin)
|
14
|
-
%w(admin)
|
15
|
-
else
|
16
|
-
[]
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# Allows to use Solidus helpers within Alchemys controller views
|
2
|
-
Alchemy::BaseHelper.include(
|
3
|
-
Spree::BaseHelper,
|
4
|
-
Spree::CheckoutHelper,
|
5
|
-
Spree::ProductsHelper,
|
6
|
-
Spree::StoreHelper,
|
7
|
-
Spree::TaxonsHelper
|
8
|
-
)
|
9
|
-
|
10
|
-
Alchemy::BaseController.include(
|
11
|
-
Spree::Core::ControllerHelpers::Auth,
|
12
|
-
Spree::Core::ControllerHelpers::Common,
|
13
|
-
Spree::Core::ControllerHelpers::Order,
|
14
|
-
Spree::Core::ControllerHelpers::PaymentParameters,
|
15
|
-
Spree::Core::ControllerHelpers::Pricing,
|
16
|
-
Spree::Core::ControllerHelpers::Search,
|
17
|
-
Spree::Core::ControllerHelpers::Store,
|
18
|
-
Spree::Core::ControllerHelpers::StrongParameters
|
19
|
-
)
|