alchemy_cms 6.0.0.pre.b5 → 6.0.0.pre.b6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c960938b7e577abd1031dc1ff066eea2bc9636f2a94d61cab753ae42e1058768
4
- data.tar.gz: d3dff1ab8a69b2dcfc2374aa78ecbbaad3c76d97fe66c23ede57d33e8f019f49
3
+ metadata.gz: a2356162437442579cc431fade3fc3486f5262d22e6a6212950634e5ac90f595
4
+ data.tar.gz: 4a933ae8c9652adbe6fef16cf2e420c31160b4352fb2fba3a15f536f67f1dbc0
5
5
  SHA512:
6
- metadata.gz: 73e65f16a6c35dd438645b36f359745db42d657ca6d7de7082714f879105c97ac296861790dc15f6c3411f25970519f2d01dc5c3b2525e88e8fc25a2fca38b80
7
- data.tar.gz: 78dedcd0ca764496af5abc4a8800675205ef6f78deb511bf8cf2f4bb5025f4e6cfe7315dc9a4d54d114a33efbb6d5ad2b53fc4de881686c8df158c7d7dfa83dd
6
+ metadata.gz: 807c2793f1805245bf12512582f2bfd06acdc777a811b070877447792d20b5cfae46b7e04276d90aed455f97fca91f88385df51317a294b9569b7e845017dfbe
7
+ data.tar.gz: 04ec712fe19f499cf0174ee0d044a6c086abec3c063cfa5df32380033de40f4373c9e0978f626a74ac83a67b190ef4154566da152b39e02dba47b15bc6d9e94f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 6.0.0-b6 (2021-09-02)
2
+
3
+ - Fix element with ingredients preview text [#2187](https://github.com/AlchemyCMS/alchemy_cms/pull/2187) ([tvdeyen](https://github.com/tvdeyen))
4
+ - Do not validate element during toggle fold and create [#2186](https://github.com/AlchemyCMS/alchemy_cms/pull/2186) ([tvdeyen](https://github.com/tvdeyen))
1
5
  ## 6.0.0-b5 (2021-08-27)
2
6
 
3
7
  - Remove spec that tests default data store value [#2184](https://github.com/AlchemyCMS/alchemy_cms/pull/2184) ([tvdeyen](https://github.com/tvdeyen))
@@ -32,14 +32,14 @@ module Alchemy
32
32
  if @paste_from_clipboard = params[:paste_from_clipboard].present?
33
33
  @element = paste_element_from_clipboard
34
34
  else
35
- @element = Element.create(create_element_params)
35
+ @element = Element.new(create_element_params)
36
36
  end
37
37
  if @page.definition["insert_elements_at"] == "top"
38
38
  @insert_at_top = true
39
- @element.move_to_top
39
+ @element.position = 1
40
40
  end
41
41
  end
42
- if @element.valid?
42
+ if @element.save
43
43
  render :create
44
44
  else
45
45
  @element.page_version = @page_version
@@ -91,10 +91,14 @@ module Alchemy
91
91
  end
92
92
  end
93
93
 
94
+ # Toggle fodls the element and persists the state in the db
95
+ #
96
+ # Ingredient validations might make the element invalid.
97
+ # In this case we are just toggling a UI state and do not care about the validations.
94
98
  def fold
95
99
  @page = @element.page
96
100
  @element.folded = !@element.folded
97
- @element.save
101
+ @element.save(validate: false)
98
102
  end
99
103
 
100
104
  private
@@ -99,12 +99,12 @@ module Alchemy
99
99
  # The ingredient that's used for element's preview text.
100
100
  #
101
101
  # It tries to find one of element's ingredients that is defined +as_element_title+.
102
- # Takes element's first ingredient if no ingredient is defined +as_element_title+.
102
+ # Takes element's first defined ingredient if no ingredient is defined +as_element_title+.
103
103
  #
104
104
  # @return (Alchemy::Ingredient)
105
105
  #
106
106
  def preview_ingredient
107
- @_preview_ingredient ||= ingredients.detect(&:preview_ingredient?) || ingredients.first
107
+ @_preview_ingredient ||= ingredients.detect(&:preview_ingredient?) || first_ingredient_by_definition
108
108
  end
109
109
 
110
110
  private
@@ -122,6 +122,13 @@ module Alchemy
122
122
  def preview_text_from_preview_ingredient(maxlength)
123
123
  preview_ingredient&.preview_text(maxlength)
124
124
  end
125
+
126
+ def first_ingredient_by_definition
127
+ return if ingredient_definitions.empty?
128
+
129
+ role = ingredient_definitions.first["role"]
130
+ ingredients.detect { |ingredient| ingredient.role == role }
131
+ end
125
132
  end
126
133
  end
127
134
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Alchemy
4
- VERSION = "6.0.0-b5"
4
+ VERSION = "6.0.0-b6"
5
5
 
6
6
  def self.version
7
7
  VERSION
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alchemy_cms/admin",
3
- "version": "6.0.0-b5",
3
+ "version": "6.0.0-b6",
4
4
  "description": "AlchemyCMS",
5
5
  "browser": "package/admin.js",
6
6
  "files": [
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: 6.0.0.pre.b5
4
+ version: 6.0.0.pre.b6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2021-08-27 00:00:00.000000000 Z
16
+ date: 2021-09-02 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: actionmailer