Add a rails helper for the new custom stream action
This commit is contained in:
@@ -2,5 +2,5 @@
|
||||
<%= render partial: "cards/stagings/stages", locals: { card: @card } %>
|
||||
<% end %>
|
||||
|
||||
<turbo-stream action="set_css_variable" target="<%= dom_id(@card, :card_container) %>" name="--card-color" value="<%= @card.color %>"></turbo-stream>
|
||||
<turbo-stream action="set_css_variable" target="<%= dom_id(@card, :ticket) %>" name="--card-color" value="<%= @card.color %>"></turbo-stream>
|
||||
<%= turbo_stream.set_css_variable dom_id(@card, :card_container), name: "--card-color", value: @card.color %>
|
||||
<%= turbo_stream.set_css_variable dom_id(@card, :ticket), name: "--card-color", value: @card.color %>
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
module TurboStreamsActionsHelper
|
||||
def set_css_variable(target, name:, value:)
|
||||
tag.turbo_stream target: target, action: "set_css_variable", name:, value:
|
||||
end
|
||||
end
|
||||
|
||||
Turbo::Streams::TagBuilder.prepend(TurboStreamsActionsHelper)
|
||||
Reference in New Issue
Block a user