alchemy-solidus 7.3.0 → 7.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/app/assets/javascripts/alchemy/solidus/admin/variant_select.js +50 -27
- data/app/views/alchemy/ingredients/_spree_variant_editor.html.erb +21 -1
- data/lib/alchemy/solidus/spree_user_extension.rb +4 -0
- data/lib/alchemy/solidus/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1182b12b2857cdeccf70d46d97155050830a92816754f5992d99441ff0b92f0
|
4
|
+
data.tar.gz: 6f1a5626551ac48979ab6f50458ed302dc2195d1e7e29db37daab95b90edebc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c6c6cfe0857555870618beb4deb66491c7c168cb3c66f870b1120c1110631cd7583fb8d661a7420daa074ff42f17e3c4b0fc613dabca5a40afe284622e24fe7
|
7
|
+
data.tar.gz: c5ecac53e8b876e2ad839fda98e478d55693f403576ca5f42f93e7eca0fb51c2da58f03b339bc355884f29f6bdc35036786ebb59c89f26ef8d120117fe3c9ec1
|
data/README.md
CHANGED
@@ -30,8 +30,9 @@ This version runs with Solidus v4.0 and up.
|
|
30
30
|
|
31
31
|
### Alchemy
|
32
32
|
|
33
|
-
This version runs with Alchemy v7.
|
33
|
+
This version runs with Alchemy v7.2
|
34
34
|
|
35
|
+
- For a Alchemy 7.0/7.1 compatible version please use the `7.2-stable` branch or `7.2` gem version.
|
35
36
|
- For a Alchemy 6.x compatible version please use the `5.0-stable` branch or `5.0` gem version.
|
36
37
|
- For a Alchemy 5.x compatible version please use the `4.1-stable` branch or `4.1` gem version.
|
37
38
|
- For a Alchemy 4.x compatible version please use the `3.1-stable` branch or `3.3` gem version.
|
@@ -1,32 +1,55 @@
|
|
1
1
|
//= require alchemy/solidus/admin/select2_config
|
2
2
|
|
3
|
-
$.fn.alchemyVariantSelect = function(options) {
|
4
|
-
|
3
|
+
$.fn.alchemyVariantSelect = function (options) {
|
4
|
+
const config = Alchemy.Solidus.getSelect2Config(options)
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
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: function (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: function (data, page) {
|
45
|
+
return {
|
46
|
+
results: data.variants,
|
47
|
+
more: page * data.per_page < data.total_count,
|
48
|
+
}
|
49
|
+
},
|
15
50
|
},
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
id: variant.id,
|
21
|
-
text: variant.frontend_display
|
22
|
-
}
|
23
|
-
}),
|
24
|
-
more: page * data.per_page < data.total_count
|
25
|
-
}
|
26
|
-
}
|
27
|
-
},
|
28
|
-
formatSelection: function(variant) {
|
29
|
-
return variant.text || variant.frontend_display
|
30
|
-
}
|
31
|
-
}))
|
51
|
+
formatSelection,
|
52
|
+
formatResult,
|
53
|
+
})
|
54
|
+
)
|
32
55
|
}
|
@@ -10,6 +10,25 @@
|
|
10
10
|
<% end %>
|
11
11
|
<% end %>
|
12
12
|
|
13
|
+
<style>
|
14
|
+
.variant-select-result > * {
|
15
|
+
display: flex;
|
16
|
+
justify-content: space-between;
|
17
|
+
min-height: 16px;
|
18
|
+
|
19
|
+
> span {
|
20
|
+
display: inline-block;
|
21
|
+
overflow: hidden;
|
22
|
+
text-overflow: ellipsis;
|
23
|
+
white-space: nowrap;
|
24
|
+
}
|
25
|
+
|
26
|
+
&:last-child {
|
27
|
+
color: hsl(224, 8%, 63%);
|
28
|
+
}
|
29
|
+
}
|
30
|
+
</style>
|
31
|
+
|
13
32
|
<script>
|
14
33
|
$('#<%= spree_variant_editor.form_field_id(:variant_id) %>').alchemyVariantSelect({
|
15
34
|
placeholder: "<%= Alchemy.t(:search_variant, scope: 'solidus') %>",
|
@@ -19,7 +38,8 @@
|
|
19
38
|
<% if spree_variant_editor.variant %>
|
20
39
|
initialSelection: {
|
21
40
|
id: <%= spree_variant_editor.variant.id %>,
|
22
|
-
|
41
|
+
name: "<%= spree_variant_editor.variant.name %>",
|
42
|
+
options_text: "<%= spree_variant_editor.variant.options_text %>"
|
23
43
|
}
|
24
44
|
<% end %>
|
25
45
|
})
|
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: 7.3.
|
4
|
+
version: 7.3.2
|
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: 2024-
|
11
|
+
date: 2024-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: alchemy_cms
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 7.2.0
|
19
|
+
version: 7.2.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '8'
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 7.2.0
|
29
|
+
version: 7.2.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '8'
|
@@ -311,7 +311,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
311
311
|
- !ruby/object:Gem::Version
|
312
312
|
version: '0'
|
313
313
|
requirements: []
|
314
|
-
rubygems_version: 3.5.
|
314
|
+
rubygems_version: 3.5.16
|
315
315
|
signing_key:
|
316
316
|
specification_version: 4
|
317
317
|
summary: The World's Most Flexible E-Commerce Platform meets The World's Most Flexible
|