alchemy_cms 8.1.12 → 8.1.13

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.
@@ -14,6 +14,12 @@ export class RemoteSelect extends AlchemyHTMLElement {
14
14
  url: { default: "" }
15
15
  }
16
16
 
17
+ // Select2 manages its own DOM after initialization, so attribute changes
18
+ // must not trigger the default re-render which would destroy the widget.
19
+ static get observedAttributes() {
20
+ return []
21
+ }
22
+
17
23
  async connected() {
18
24
  await setupSelectLocale()
19
25
 
@@ -34,6 +40,11 @@ export class RemoteSelect extends AlchemyHTMLElement {
34
40
  * @param {Event} event
35
41
  */
36
42
  onChange(event) {
43
+ // Update selection attribute so re-attaching the select2 component to
44
+ // the same input (e.g. after dragndrop) does not reset the selection.
45
+ if (event.added) {
46
+ this.setAttribute("selection", JSON.stringify(event.added))
47
+ }
37
48
  this.dispatchCustomEvent("RemoteSelect.Change", {
38
49
  removed: event.removed,
39
50
  added: event.added
@@ -1,11 +1,18 @@
1
1
  class ConvertSelectValueForMultiple < ActiveRecord::Migration[7.1]
2
2
  def up
3
3
  say_with_time "Converting Alchemy::Ingredients::Select values to multiple" do
4
- update <<-SQL.squish
5
- UPDATE alchemy_ingredients
6
- SET value = '["' || value || '"]'
7
- WHERE type = 'Alchemy::Ingredients::Select' AND value NOT LIKE '["%"]';
8
- SQL
4
+ Alchemy::Ingredients::Select
5
+ .where.not("value LIKE ?", '["%')
6
+ .update_all(
7
+ Arel.sql(
8
+ case ActiveRecord::Base.connection.adapter_name
9
+ when /mysql|mariadb/i
10
+ "value = CONCAT('[\"', value, '\"]')"
11
+ else
12
+ "value = '[\"' || value || '\"]'"
13
+ end
14
+ )
15
+ )
9
16
  end
10
17
  end
11
18
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Alchemy
4
- VERSION = "8.1.12"
4
+ VERSION = "8.1.13"
5
5
 
6
6
  def self.version
7
7
  VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.1.12
4
+ version: 8.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
@@ -1458,7 +1458,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1458
1458
  version: '0'
1459
1459
  requirements:
1460
1460
  - ImageMagick (libmagick), v6.6 or greater.
1461
- rubygems_version: 4.0.6
1461
+ rubygems_version: 4.0.10
1462
1462
  specification_version: 4
1463
1463
  summary: A powerful, userfriendly and flexible CMS for Rails
1464
1464
  test_files: []