alchemy_cms 6.0.0.pre.b4 → 6.0.0.pre.b6

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.

Potentially problematic release.


This version of alchemy_cms might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb49f5d73d0fe450fc5b15c1a31b8ea9db3c281a0ffbc10ea41fac56617f0ba8
4
- data.tar.gz: a0a78888094965fc097dcfe0642ef1ea22905300abff1659257d8ae2b7990670
3
+ metadata.gz: a2356162437442579cc431fade3fc3486f5262d22e6a6212950634e5ac90f595
4
+ data.tar.gz: 4a933ae8c9652adbe6fef16cf2e420c31160b4352fb2fba3a15f536f67f1dbc0
5
5
  SHA512:
6
- metadata.gz: 0ce83617901077c47a15d5e3e3ec48e3f78ff1c879a18467a44aab0c20d69b59f4a7eb698b49688ca6e7d5cd45b1127196084943c4604d7474ea588eeae176e9
7
- data.tar.gz: 6e13fe6a39778668e02f5f09c475db1029f28fb42f8f439464798f017169ee28247f45e3a444c5c82a88d2d928cbdc4492ce5ba4d21dea509e61cb8098b8102f
6
+ metadata.gz: 807c2793f1805245bf12512582f2bfd06acdc777a811b070877447792d20b5cfae46b7e04276d90aed455f97fca91f88385df51317a294b9569b7e845017dfbe
7
+ data.tar.gz: 04ec712fe19f499cf0174ee0d044a6c086abec3c063cfa5df32380033de40f4373c9e0978f626a74ac83a67b190ef4154566da152b39e02dba47b15bc6d9e94f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
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))
5
+ ## 6.0.0-b5 (2021-08-27)
6
+
7
+ - Remove spec that tests default data store value [#2184](https://github.com/AlchemyCMS/alchemy_cms/pull/2184) ([tvdeyen](https://github.com/tvdeyen))
8
+ - Remove data store accessor from ingredient base class [#2183](https://github.com/AlchemyCMS/alchemy_cms/pull/2183) ([tvdeyen](https://github.com/tvdeyen))
9
+
1
10
  ## 6.0.0-b4 (2021-08-27)
2
11
 
3
12
  - Load custom Tinymce config for ingredients [#2182](https://github.com/AlchemyCMS/alchemy_cms/pull/2182) ([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
@@ -118,11 +118,6 @@ module Alchemy
118
118
  value.to_s[0..maxlength - 1]
119
119
  end
120
120
 
121
- # Cross DB adapter data accessor that works
122
- def data
123
- @_data ||= (self[:data] || {}).with_indifferent_access
124
- end
125
-
126
121
  # The path to the view partial of the ingredient
127
122
  # @return [String]
128
123
  def to_partial_path
@@ -16,7 +16,6 @@ RSpec.shared_examples_for "an alchemy ingredient" do
16
16
  it { is_expected.to belong_to(:related_object).optional }
17
17
  it { is_expected.to validate_presence_of(:role) }
18
18
  it { is_expected.to validate_presence_of(:type) }
19
- it { expect(subject.data).to eq({}) }
20
19
 
21
20
  describe "#settings" do
22
21
  subject { ingredient.settings }
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Alchemy
4
- VERSION = "6.0.0-b4"
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-b4",
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.b4
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