alchemy-solidus 7.3.0 → 7.3.2

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: 823fe7fab5027f254ca1440418ca0f5957e3e4825dba007096b8fd5268694141
4
- data.tar.gz: cb223e06aa86c2a2cffed82b594e03d6febe9004b0fe55787b47b2ce76a5c3a0
3
+ metadata.gz: e1182b12b2857cdeccf70d46d97155050830a92816754f5992d99441ff0b92f0
4
+ data.tar.gz: 6f1a5626551ac48979ab6f50458ed302dc2195d1e7e29db37daab95b90edebc0
5
5
  SHA512:
6
- metadata.gz: ff3cadb5fc31dc7603910e487cbaf59e13edf00f764ddb38af6dcd25f745b53e83a286ece56829acb34bcda3711210cb6144ae1cf3488a95cf00a0c48c06ecf2
7
- data.tar.gz: 061dbe3d8ccf9c1884dac806d44737f9e6e5f0d605da197f517200f2fd2a40dd0a1820c5b08e28d62d02eb3deb07346dbb3de68e55fc91c4b2344844e7efa755
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.0 and v7.1
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
- var config = Alchemy.Solidus.getSelect2Config(options)
3
+ $.fn.alchemyVariantSelect = function (options) {
4
+ const config = Alchemy.Solidus.getSelect2Config(options)
5
5
 
6
- this.select2($.extend(true, config, {
7
- ajax: {
8
- data: function(term, page) {
9
- return {
10
- q: $.extend({
11
- product_name_or_sku_cont: term
12
- }, options.query_params),
13
- page: page
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
- results: function(data, page) {
17
- return {
18
- results: data.variants.map(function(variant) {
19
- return {
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
- text: "<%= spree_variant_editor.variant.name %>"
41
+ name: "<%= spree_variant_editor.variant.name %>",
42
+ options_text: "<%= spree_variant_editor.variant.options_text %>"
23
43
  }
24
44
  <% end %>
25
45
  })
@@ -5,6 +5,10 @@ module Alchemy
5
5
  klass.has_many :folded_pages, class_name: "Alchemy::FoldedPage"
6
6
  end
7
7
 
8
+ def alchemy_display_name
9
+ email
10
+ end
11
+
8
12
  def alchemy_roles
9
13
  if has_spree_role?(:admin)
10
14
  %w(admin)
@@ -1,5 +1,5 @@
1
1
  module Alchemy
2
2
  module Solidus
3
- VERSION = "7.3.0"
3
+ VERSION = "7.3.2"
4
4
  end
5
5
  end
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.0
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-05-24 00:00:00.000000000 Z
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.rc1
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.rc1
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.9
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