alchemy_cms 6.0.0.b2 → 6.0.0.b3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -0
  3. data/app/assets/stylesheets/alchemy/_extends.scss +15 -2
  4. data/app/assets/stylesheets/alchemy/archive.scss +2 -1
  5. data/app/controllers/alchemy/admin/elements_controller.rb +1 -0
  6. data/app/decorators/alchemy/element_editor.rb +7 -4
  7. data/app/decorators/alchemy/ingredient_editor.rb +5 -1
  8. data/app/helpers/alchemy/elements_block_helper.rb +8 -6
  9. data/app/models/alchemy/element/element_essences.rb +14 -3
  10. data/app/models/alchemy/element/element_ingredients.rb +11 -3
  11. data/app/models/alchemy/ingredient.rb +16 -57
  12. data/app/views/alchemy/admin/elements/create.js.erb +1 -1
  13. data/app/views/alchemy/admin/elements/destroy.js.erb +1 -3
  14. data/app/views/alchemy/admin/elements/fold.js.erb +2 -2
  15. data/app/views/alchemy/ingredients/_boolean_editor.html.erb +1 -1
  16. data/app/views/alchemy/ingredients/_file_editor.html.erb +3 -1
  17. data/app/views/alchemy/ingredients/_headline_editor.html.erb +1 -1
  18. data/app/views/alchemy/ingredients/_html_editor.html.erb +1 -1
  19. data/app/views/alchemy/ingredients/_link_editor.html.erb +8 -8
  20. data/app/views/alchemy/ingredients/_node_editor.html.erb +1 -0
  21. data/app/views/alchemy/ingredients/_page_editor.html.erb +1 -0
  22. data/app/views/alchemy/ingredients/_picture_editor.html.erb +7 -6
  23. data/app/views/alchemy/ingredients/_select_editor.html.erb +1 -0
  24. data/app/views/alchemy/ingredients/_text_editor.html.erb +5 -4
  25. data/lib/alchemy/upgrader/tasks/ingredients_migrator.rb +4 -1
  26. data/lib/alchemy/version.rb +1 -1
  27. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 50e6a89657c457ab3061bdc6d2cff1eba7ab25856249071e1bbe8c7684e18055
4
- data.tar.gz: 282dd5e51249513e14309c4d98a09822b2fd7d038f8494f3313e00bc1026f8df
3
+ metadata.gz: c8fcd022eba5fdba4ce96cfe4971344ced0191b6d12d9cbd7bad923b07b7359a
4
+ data.tar.gz: 9dfbf5f590c6c2e8d562bf81daeb8faf3a1358f5f46aeb8857adef4d48fd6181
5
5
  SHA512:
6
- metadata.gz: 54fc70c8b8ba0305d79d3e6309d4dab7a0a050a3aad1d06014fd3f38f9af34f81970a68358a7c3c222d2d740896dccb905920e6a67ee43bfb226d925916b67e6
7
- data.tar.gz: 5d5c5ea2794e1f3c2e84a6b99f4eeb07fe284e98dca598c93361ed5f977b3b4b0e966372f2bba1c32f6b5bf21f8f94ec6cb68bd7b375f6bfb899b295bc724e11
6
+ metadata.gz: 82cc3e7f0c3b0e8fb8a4d2219d8237d66db02275b878951be1fcc0d12f9a7fdd750415ad45b5af03a05e6abce298c718551541dc80774c689b395d758d39d942
7
+ data.tar.gz: 665d8a15204e872ab41867e1466c4611fec7c46f83d862669c89d3e5c3038f30fa1dfb45fb56d227a71b92c945a9c45de9a5d887bbb726af9d49b5c87121d2c9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## 6.0.0.b3 (2021-08-12)
2
+
3
+ ### Fixes
4
+
5
+ - Simplify ingredient creation [#2171](https://github.com/AlchemyCMS/alchemy_cms/pull/2171) ([tvdeyen](https://github.com/tvdeyen))
6
+ - Return ingredients value if element asked for ingredient [#2170](https://github.com/AlchemyCMS/alchemy_cms/pull/2170) ([tvdeyen](https://github.com/tvdeyen))
7
+ - Fix ingredient form field DOM ids [#2167](https://github.com/AlchemyCMS/alchemy_cms/pull/2167) ([tvdeyen](https://github.com/tvdeyen))
8
+ - Ensure resource table ends before the filter/tag sidebar [#2166](https://github.com/AlchemyCMS/alchemy_cms/pull/2166) ([robinboening](https://github.com/robinboening))
9
+ - Return fully namespaced ingredient constant [#2164](https://github.com/AlchemyCMS/alchemy_cms/pull/2164) ([tvdeyen](https://github.com/tvdeyen))
10
+ - (Re)-init Tinymce for elements with ingredients [#2163](https://github.com/AlchemyCMS/alchemy_cms/pull/2163) ([tvdeyen](https://github.com/tvdeyen))
11
+
1
12
  ## 6.0.0.b2 (2021-08-05)
2
13
 
3
14
  ### Features
@@ -31,15 +31,28 @@
31
31
  line-height: $form-field-line-height;
32
32
  transition: $transition-duration;
33
33
 
34
- &:focus {
34
+ &:focus:not(.readonly) {
35
35
  @include default-focus-style($box-shadow: 0 0 0 1px $focus-color);
36
36
  }
37
37
 
38
- &[disabled], .disabled {
38
+ &[disabled],
39
+ &.disabled,
40
+ &[readonly],
41
+ &.readonly {
39
42
  color: $form-field-disabled-text-color;
40
43
  background-color: $form-field-disabled-bg-color;
44
+ cursor: default;
45
+ }
46
+
47
+ &[disabled],
48
+ &.disabled {
41
49
  cursor: not-allowed;
42
50
  }
51
+
52
+ &[readonly],
53
+ &.readonly {
54
+ pointer-events: none;
55
+ }
43
56
  }
44
57
 
45
58
  %gradiated-toolbar {
@@ -20,7 +20,8 @@
20
20
  padding-bottom: 60px;
21
21
 
22
22
  &.with_tag_filter {
23
- padding-right: 242px;
23
+ width: calc(100% - 235px);
24
+ overflow-x: auto;
24
25
  }
25
26
  }
26
27
 
@@ -65,6 +65,7 @@ module Alchemy
65
65
  end
66
66
 
67
67
  def destroy
68
+ @richtext_ids = @element.richtext_contents_ids + @element.richtext_ingredients_ids
68
69
  @element.destroy
69
70
  @notice = Alchemy.t("Successfully deleted element") % { element: @element.display_name }
70
71
  end
@@ -26,7 +26,7 @@ module Alchemy
26
26
  # @return Array<Alchemy::IngredientEditor>
27
27
  def ingredients
28
28
  element.definition.fetch(:ingredients, []).map do |ingredient|
29
- Alchemy::IngredientEditor.new(find_or_create_ingredient(ingredient[:role]))
29
+ Alchemy::IngredientEditor.new(find_or_create_ingredient(ingredient))
30
30
  end
31
31
  end
32
32
 
@@ -121,9 +121,12 @@ module Alchemy
121
121
  Alchemy::Content.create(element: element, name: name)
122
122
  end
123
123
 
124
- def find_or_create_ingredient(role)
125
- element.ingredients.find { |i| i.role == role } ||
126
- Ingredient.create(element: element, role: role)
124
+ def find_or_create_ingredient(definition)
125
+ element.ingredients.detect { |i| i.role == definition[:role] } ||
126
+ element.ingredients.create!(
127
+ role: definition[:role],
128
+ type: Alchemy::Ingredient.normalize_type(definition[:type]),
129
+ )
127
130
  end
128
131
  end
129
132
  end
@@ -64,8 +64,12 @@ module Alchemy
64
64
  "element[ingredients_attributes][#{form_field_counter}][#{column}]"
65
65
  end
66
66
 
67
+ # Returns a unique string to be passed to a form field id.
68
+ #
69
+ # @param column [String] A Ingredient column_name. Default is 'value'
70
+ #
67
71
  def form_field_id(column = "value")
68
- "element_ingredients_attributes_#{form_field_counter}_#{column}"
72
+ "element_#{element.id}_ingredient_#{id}_#{column}"
69
73
  end
70
74
 
71
75
  # Fixes Rails partial renderer calling to_model on the object
@@ -51,21 +51,23 @@ module Alchemy
51
51
  # If the element uses +ingredients+ it returns the +value+ of the ingredient record.
52
52
  #
53
53
  def ingredient(name)
54
- element.ingredient(name).presence || element.ingredient_by_role(name)&.value
54
+ element.ingredient(name)
55
55
  end
56
56
 
57
- deprecate ingredient: :value, deprecator: Alchemy::Deprecation
58
-
59
57
  # Returns the value of one of the element's ingredients.
60
58
  #
61
59
  def value(name)
62
- element.ingredient_by_role(name)&.value
60
+ element.value_for(name)
63
61
  end
64
62
 
65
- # Returns true if the given content or ingredient has been filled by the user.
63
+ # Returns true if the given content or ingredient has a value.
66
64
  #
67
65
  def has?(name)
68
- element.has_ingredient?(name) || element.has_value_for?(name)
66
+ if element.ingredient_definitions.any?
67
+ element.has_value_for?(name)
68
+ else
69
+ element.has_ingredient?(name)
70
+ end
69
71
  end
70
72
 
71
73
  # Return's the given content's essence.
@@ -5,10 +5,20 @@ module Alchemy
5
5
  module ElementEssences
6
6
  # Returns the contents essence value (aka. ingredient) for passed content name.
7
7
  def ingredient(name)
8
- content = content_by_name(name)
9
- return nil if content.blank?
8
+ ing = ingredient_by_role(name)
9
+ if ing
10
+ Alchemy::Deprecation.warn <<~WARN
11
+ Using `element.ingredient` to get the value of an ingredient is deprecated and will change in Alchemy 6.1
12
+ If you want to read the value of an elements ingredient please use `element.value_for(:ingredient_role)` instead.
13
+ The next version of Alchemy will return a `Alchemy::Ingredient` record instead.
14
+ WARN
15
+ ing.value
16
+ else
17
+ content = content_by_name(name)
18
+ return nil if content.blank?
10
19
 
11
- content.ingredient
20
+ content.ingredient
21
+ end
12
22
  end
13
23
 
14
24
  # True if the element has a content for given name,
@@ -16,6 +26,7 @@ module Alchemy
16
26
  def has_ingredient?(name)
17
27
  ingredient(name).present?
18
28
  end
29
+ deprecate has_ingredient?: :has_value_for?, deprecator: Alchemy::Deprecation
19
30
 
20
31
  # Returns all essence errors in the format of:
21
32
  #
@@ -22,6 +22,11 @@ module Alchemy
22
22
  validates_associated :ingredients, on: :update
23
23
  end
24
24
 
25
+ # The value of an ingredient of the element by role
26
+ def value_for(role)
27
+ ingredient_by_role(role)&.value
28
+ end
29
+
25
30
  # Find first ingredient from element by given role.
26
31
  def ingredient_by_role(role)
27
32
  ingredients.detect { |ingredient| ingredient.role == role.to_s }
@@ -87,7 +92,7 @@ module Alchemy
87
92
  # True if the element has a ingredient for given name
88
93
  # that has a non blank value.
89
94
  def has_value_for?(role)
90
- ingredient_by_role(role)&.value.present?
95
+ value_for(role).present?
91
96
  end
92
97
 
93
98
  # Ingredient validation error messages
@@ -167,8 +172,11 @@ module Alchemy
167
172
 
168
173
  # Builds ingredients for this element as described in the +elements.yml+
169
174
  def build_ingredients
170
- self.ingredients = ingredient_definitions.map do |attributes|
171
- Ingredient.build(role: attributes[:role], element: self)
175
+ ingredient_definitions.each do |attributes|
176
+ ingredients.build(
177
+ role: attributes[:role],
178
+ type: Alchemy::Ingredient.normalize_type(attributes[:type]),
179
+ )
172
180
  end
173
181
  end
174
182
  end
@@ -6,12 +6,13 @@ module Alchemy
6
6
 
7
7
  include Hints
8
8
 
9
- self.abstract_class = true
10
9
  self.table_name = "alchemy_ingredients"
11
10
 
12
11
  belongs_to :element, touch: true, class_name: "Alchemy::Element", inverse_of: :ingredients
13
12
  belongs_to :related_object, polymorphic: true, optional: true
14
13
 
14
+ before_validation(on: :create) { self.value ||= default_value }
15
+
15
16
  validates :type, presence: true
16
17
  validates :role, presence: true
17
18
 
@@ -33,32 +34,6 @@ module Alchemy
33
34
  scope :videos, -> { where(type: "Alchemy::Ingredients::Video") }
34
35
 
35
36
  class << self
36
- # Builds concrete ingredient class as described in the +elements.yml+
37
- def build(attributes = {})
38
- element = attributes[:element]
39
- raise ArgumentError, "No element given. Please pass element in attributes." if element.nil?
40
- raise ArgumentError, "No role given. Please pass role in attributes." if attributes[:role].nil?
41
-
42
- definition = element.ingredient_definition_for(attributes[:role])
43
- if definition.nil?
44
- raise DefinitionError,
45
- "No definition found for #{attributes[:role]}. Please define #{attributes[:role]} on #{element[:name]}."
46
- end
47
-
48
- ingredient_class = Ingredient.ingredient_class_by_type(definition[:type])
49
- ingredient_class.new(
50
- type: Ingredient.normalize_type(definition[:type]),
51
- value: default_value(definition),
52
- role: definition[:role],
53
- element: element,
54
- )
55
- end
56
-
57
- # Creates concrete ingredient class as described in the +elements.yml+
58
- def create(attributes = {})
59
- build(attributes).tap(&:save)
60
- end
61
-
62
37
  # Defines getter and setter method aliases for related object
63
38
  #
64
39
  # @param [String|Symbol] The name of the alias
@@ -78,20 +53,6 @@ module Alchemy
78
53
  end
79
54
  end
80
55
 
81
- # Returns an ingredient class by type
82
- #
83
- # Raises ArgumentError if there is no such class in the
84
- # +Alchemy::Ingredients+ module namespace.
85
- #
86
- # If you add custom ingredient class,
87
- # put them in the +Alchemy::Ingredients+ module namespace
88
- #
89
- # @param [String] The ingredient class name to constantize
90
- # @return [Class]
91
- def ingredient_class_by_type(ingredient_type)
92
- Alchemy::Ingredients.const_get(ingredient_type.to_s.classify.demodulize)
93
- end
94
-
95
56
  # Modulize ingredient type
96
57
  #
97
58
  # Makes sure the passed ingredient type is in the +Alchemy::Ingredients+
@@ -112,22 +73,6 @@ module Alchemy
112
73
  default: Alchemy.t("ingredient_roles.#{role}", default: role.humanize),
113
74
  )
114
75
  end
115
-
116
- private
117
-
118
- # Returns the default value from ingredient definition
119
- #
120
- # If the value is a symbol it gets passed through i18n
121
- # inside the +alchemy.default_ingredient_texts+ scope
122
- def default_value(definition)
123
- default = definition[:default]
124
- case default
125
- when Symbol
126
- Alchemy.t(default, scope: :default_ingredient_texts)
127
- else
128
- default
129
- end
130
- end
131
76
  end
132
77
 
133
78
  # Compatibility method for access from element
@@ -220,5 +165,19 @@ module Alchemy
220
165
  def hint_translation_attribute
221
166
  role
222
167
  end
168
+
169
+ # Returns the default value from ingredient definition
170
+ #
171
+ # If the value is a symbol it gets passed through i18n
172
+ # inside the +alchemy.default_ingredient_texts+ scope
173
+ def default_value
174
+ default = definition[:default]
175
+ case default
176
+ when Symbol
177
+ Alchemy.t(default, scope: :default_ingredient_texts)
178
+ else
179
+ default
180
+ end
181
+ end
223
182
  end
224
183
  end
@@ -34,7 +34,7 @@
34
34
 
35
35
  Alchemy.growl('<%= Alchemy.t(:successfully_added_element) %>');
36
36
  Alchemy.closeCurrentDialog();
37
- Alchemy.Tinymce.init(<%= @element.richtext_contents_ids.to_json %>);
37
+ Alchemy.Tinymce.init(<%= (@element.richtext_contents_ids + @element.richtext_ingredients_ids).to_json %>);
38
38
  Alchemy.PreviewWindow.refresh(function() {
39
39
  Alchemy.ElementEditors.focusElementPreview(<%= @element.id %>);
40
40
  });
@@ -3,9 +3,7 @@ $('#element_<%= @element.id %>').hide(200, function() {
3
3
  Alchemy.growl('<%= j @notice %>');
4
4
  $('#element_area .sortable-elements').sortable('refresh');
5
5
  Alchemy.PreviewWindow.refresh();
6
- <% @element.richtext_contents_ids.each do |id| %>
7
- tinymce.get('tinymce_<%= id %>').remove();
8
- <% end %>
6
+ Alchemy.Tinymce.remove(<%= @richtext_ids.to_json %>);
9
7
  <% if @element.fixed? %>
10
8
  Alchemy.FixedElements.removeTab(<%= @element.id %>);
11
9
  <% end %>
@@ -14,12 +14,12 @@
14
14
 
15
15
  <% if @element.folded? -%>
16
16
 
17
- Alchemy.Tinymce.remove(<%= @element.richtext_contents_ids.to_json %>);
17
+ Alchemy.Tinymce.remove(<%= (@element.richtext_contents_ids + @element.richtext_ingredients_ids).to_json %>);
18
18
 
19
19
  <% else -%>
20
20
 
21
21
  $el.trigger('FocusElementEditor.Alchemy');
22
- Alchemy.Tinymce.init(<%= @element.richtext_contents_ids.to_json %>);
22
+ Alchemy.Tinymce.init(<%= (@element.richtext_contents_ids + @element.richtext_ingredients_ids).to_json %>);
23
23
  Alchemy.GUI.initElement($el);
24
24
  Alchemy.SortableElements(
25
25
  <%= @page.id %>,
@@ -3,7 +3,7 @@
3
3
  data: boolean_editor.data_attributes do %>
4
4
  <%= element_form.fields_for(:ingredients, boolean_editor.ingredient) do |f| %>
5
5
  <%= f.label :value, style: "display: inline-block" do %>
6
- <%= f.check_box :value %>
6
+ <%= f.check_box :value, id: nil %>
7
7
  <%= render_ingredient_role(boolean_editor) %>
8
8
  <% end %>
9
9
  <%= render_hint_for(boolean_editor) %>
@@ -44,7 +44,9 @@
44
44
  },
45
45
  title: Alchemy.t(:edit_file_properties) %>
46
46
  </div>
47
- <%= f.hidden_field :attachment_id, value: file_editor.attachment&.id %>
47
+ <%= f.hidden_field :attachment_id,
48
+ value: file_editor.attachment&.id,
49
+ id: file_editor.form_field_id(:attachment_id) %>
48
50
  </div>
49
51
  <% end %>
50
52
  <% end %>
@@ -3,7 +3,7 @@
3
3
  data: headline_editor.data_attributes do %>
4
4
  <%= element_form.fields_for(:ingredients, headline_editor.ingredient) do |f| %>
5
5
  <%= ingredient_label(headline_editor) %>
6
- <%= f.text_field :value %>
6
+ <%= f.text_field :value, id: nil %>
7
7
 
8
8
  <div class="input-row">
9
9
  <% if headline_editor.level_options.length > 1 %>
@@ -3,6 +3,6 @@
3
3
  data: html_editor.data_attributes do %>
4
4
  <%= element_form.fields_for(:ingredients, html_editor.ingredient) do |f| %>
5
5
  <%= ingredient_label(html_editor) %>
6
- <%= f.text_area :value %>
6
+ <%= f.text_area :value, id: nil %>
7
7
  <% end %>
8
8
  <% end %>
@@ -4,15 +4,15 @@
4
4
  <%= element_form.fields_for(:ingredients, link_editor.ingredient) do |f| %>
5
5
  <%= ingredient_label(link_editor) %>
6
6
  <%= f.text_field :value,
7
- class: "thin_border text_with_icon disabled",
8
- name: nil,
9
- id: nil,
10
- disabled: true
7
+ class: "thin_border text_with_icon readonly",
8
+ id: link_editor.form_field_id,
9
+ "data-link-value": true,
10
+ readonly: true,
11
+ tabindex: -1
11
12
  %>
12
- <%= f.hidden_field :value, "data-link-value": true %>
13
- <%= f.hidden_field :link_title, "data-link-title": true %>
14
- <%= f.hidden_field :link_class_name, "data-link-class": true %>
15
- <%= f.hidden_field :link_target, "data-link-target": true %>
13
+ <%= f.hidden_field :link_title, "data-link-title": true, id: nil %>
14
+ <%= f.hidden_field :link_class_name, "data-link-class": true, id: nil %>
15
+ <%= f.hidden_field :link_target, "data-link-target": true, id: nil %>
16
16
  <% end %>
17
17
  <%= render "alchemy/ingredients/shared/link_tools", ingredient_editor: link_editor %>
18
18
  <% end %>
@@ -5,6 +5,7 @@
5
5
  <%= ingredient_label(node_editor, :node_id) %>
6
6
  <%= f.text_field :node_id,
7
7
  value: node_editor.node&.id,
8
+ id: node_editor.form_field_id(:node_id),
8
9
  class: 'alchemy_selectbox full_width' %>
9
10
  <% end %>
10
11
  <% end %>
@@ -5,6 +5,7 @@
5
5
  <%= ingredient_label(page_editor, :page_id) %>
6
6
  <%= f.text_field :page_id,
7
7
  value: page_editor.page&.id,
8
+ id: page_editor.form_field_id(:page_id),
8
9
  class: 'alchemy_selectbox full_width' %>
9
10
  <% end %>
10
11
  <% end %>
@@ -44,16 +44,17 @@
44
44
  </div>
45
45
  <% end %>
46
46
  <%= f.hidden_field :picture_id, value: picture_editor.picture&.id,
47
+ id: picture_editor.form_field_id(:picture_id),
47
48
  data: {
48
49
  picture_id: true,
49
50
  image_file_width: picture_editor.image_file_width,
50
51
  image_file_height: picture_editor.image_file_height
51
52
  } %>
52
- <%= f.hidden_field :link, data: { link_value: true } %>
53
- <%= f.hidden_field :link_title, data: { link_title: true } %>
54
- <%= f.hidden_field :link_class_name, data: { link_class: true } %>
55
- <%= f.hidden_field :link_target, data: { link_target: true } %>
56
- <%= f.hidden_field :crop_from, data: { crop_from: true } %>
57
- <%= f.hidden_field :crop_size, data: { crop_size: true } %>
53
+ <%= f.hidden_field :link, data: { link_value: true }, id: nil %>
54
+ <%= f.hidden_field :link_title, data: { link_title: true }, id: nil %>
55
+ <%= f.hidden_field :link_class_name, data: { link_class: true }, id: nil %>
56
+ <%= f.hidden_field :link_target, data: { link_target: true }, id: nil %>
57
+ <%= f.hidden_field :crop_from, data: { crop_from: true }, id: nil %>
58
+ <%= f.hidden_field :crop_size, data: { crop_size: true }, id: nil %>
58
59
  <% end %>
59
60
  <% end %>
@@ -22,6 +22,7 @@
22
22
  options_tags = options_for_select(select_values, select_editor.value)
23
23
  end %>
24
24
  <%= f.select :value, options_tags, {}, {
25
+ id: nil,
25
26
  class: ["alchemy_selectbox", "ingredient-editor-select"]
26
27
  } %>
27
28
  <% end %>
@@ -7,12 +7,13 @@
7
7
  <%= ingredient_label(text_editor) %>
8
8
  <%= f.text_field :value,
9
9
  class: text_editor.settings[:linkable] ? "text_with_icon" : "",
10
+ id: nil,
10
11
  type: text_editor.settings[:input_type] || "text" %>
11
12
  <% if text_editor.settings[:linkable] %>
12
- <%= f.hidden_field :link, "data-link-value": true %>
13
- <%= f.hidden_field :link_title, "data-link-title": true %>
14
- <%= f.hidden_field :link_class_name, "data-link-class": true%>
15
- <%= f.hidden_field :link_target, "data-link-target": true %>
13
+ <%= f.hidden_field :link, "data-link-value": true, id: nil %>
14
+ <%= f.hidden_field :link_title, "data-link-title": true, id: nil %>
15
+ <%= f.hidden_field :link_class_name, "data-link-class": true, id: nil %>
16
+ <%= f.hidden_field :link_target, "data-link-target": true, id: nil %>
16
17
  <%= render "alchemy/ingredients/shared/link_tools", ingredient_editor: text_editor %>
17
18
  <% end %>
18
19
  <% end %>
@@ -30,7 +30,10 @@ module Alchemy::Upgrader::Tasks
30
30
  next unless content
31
31
 
32
32
  essence = content.essence
33
- ingredient = Alchemy::Ingredient.build(role: ingredient_definition[:role], element: element)
33
+ ingredient = element.ingredients.build(
34
+ role: ingredient_definition[:role],
35
+ type: Alchemy::Ingredient.normalize_type(ingredient_definition[:type]),
36
+ )
34
37
  belongs_to_associations = essence.class.reflect_on_all_associations(:belongs_to)
35
38
  if belongs_to_associations.any?
36
39
  ingredient.related_object = essence.public_send(belongs_to_associations.first.name)
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Alchemy
4
- VERSION = "6.0.0.b2"
4
+ VERSION = "6.0.0.b3"
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: 6.0.0.b2
4
+ version: 6.0.0.b3
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-05 00:00:00.000000000 Z
16
+ date: 2021-08-12 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: actionmailer