Skip to content

Commit d1c2bad

Browse files
committed
fix(PictureEditor): Replace after update
This fixes an issue with css class label not appearing if it is not yet present. Signed-off-by: Thomas von Deyen <vondeyen@blish.cloud>
1 parent 91211fd commit d1c2bad

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

app/controllers/alchemy/admin/ingredients_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def edit
1515
end
1616

1717
def update
18+
@page = @ingredient.page # necessary to a render picture ingredient component
1819
@ingredient.update(ingredient_params)
1920
end
2021

app/views/alchemy/admin/ingredients/update.turbo_stream.erb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
<alchemy-action name="updateAnchorIcon" params="<%= [@ingredient.id, @ingredient.dom_id.present?].to_json %>"></alchemy-action>
55
<% end %>
66
<% if @ingredient.type == "Alchemy::Ingredients::Picture" && @ingredient.css_class.present? %>
7-
<%= turbo_stream.replace_all "[data-ingredient-id='#{@ingredient.id}'] .picture_ingredient_css_class",
8-
partial: "alchemy/ingredients/shared/picture_css_class",
9-
locals: {
10-
css_class: @ingredient.css_class
11-
} %>
7+
<%= turbo_stream.replace @ingredient do %>
8+
<%= render Alchemy::Ingredients::PictureEditor.new(@ingredient) %>
9+
<% end %>
1210
<% end %>

0 commit comments

Comments
 (0)