-
Notifications
You must be signed in to change notification settings - Fork 358
Broadcast HTML from Model #245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broadcast HTML from Model #245
Conversation
|
Nice! Can you amend docs too? |
|
Since you're a first time contributor, a maintainer with GitHub permissions will need to intervene so that your tests to run in CI. |
…revents default partial option from being added which currently overrides the HTML
242e73c to
2a4f462
Compare
did to rerun cli tests
|
Tests failed last time but pass in development |
|
I would really like to get this merged in I need a rerun of the cli @dhh |
|
In our project we have had the need to broadcast a template instead of a partial. I think the code would be very similar to the one @yunggindigo introduced. Something like: unless o.include?(:html) || o.include?(:template)
o[:partial] ||= to_partial_path
end |
|
@bgvo the option to pass What is the use case you have in mind? |
|
I've run into (I think) a similar problem. There are times the turbo frame needing an update lives in a template, rather than a partial. There seems to be no way for me to target that frame from the broadcast command. Since this is based loosely on ActionView::ObjectRenderer I would have expected to be able to pass Especially for more complex relationships when it's not just the object itself but related objects or more complex views that might need the update. I've updated my code in a similar way to @bgvo above. |
|
@romanos if you were to |
|
@romanos For this problem it would make sense to put the content that lives currently in the |
|
Yes these workarounds... work. But it smelled funny so I went with the aforementioned method. I've been keeping my eye out cause I can't be the only one. (From mobile) |
Allows option to pass in html to broadcast from model
something like this will allow you to add html to a broadcast instead of a partial or otherwise automatically finding a partial with to_partial_path
broadcast_replace_to(:feed, html: "<p> Random HTML </p>")Allows option to pass in html to broadcast from model this works with the **rendering methods included from the Turbo::Broadcastable module.