diff --git a/app/javascript/initializers/custom_stream_actions.js b/app/javascript/initializers/custom_stream_actions.js new file mode 100644 index 000000000..fecb25ff5 --- /dev/null +++ b/app/javascript/initializers/custom_stream_actions.js @@ -0,0 +1,8 @@ +import { Turbo } from "@hotwired/turbo-rails" + +Turbo.StreamActions.set_css_variable = function() { + const name = this.getAttribute("name") + const value = this.getAttribute("value") + + this.targetElements.forEach(element => element.style.setProperty(name, value)) +} diff --git a/app/javascript/initializers/index.js b/app/javascript/initializers/index.js index 10fb36975..01fdd9220 100644 --- a/app/javascript/initializers/index.js +++ b/app/javascript/initializers/index.js @@ -1 +1,2 @@ import "initializers/current" +import "initializers/custom_stream_actions" diff --git a/app/views/cards/show.html.erb b/app/views/cards/show.html.erb index 60d74f89e..753c2e464 100644 --- a/app/views/cards/show.html.erb +++ b/app/views/cards/show.html.erb @@ -51,7 +51,7 @@ <% end %>