Ruby on Rails #153 Refactoring Hotwire Modals
21/11/2023 (6 months ago)
I AM SORRY for not providing the complete, best approach right away.
In E151 we connected turbo frame modals
with the html dialog element.
However this approach was not optimal:
- We were needlessly adding a stimulus controller on the BODY html tag;
- dialog html was present in the layout file, even if we do not need it right now;
Let's clean up the mess and make our modals even better! ✨
Special thanks to @ledockol for pushing me on this one! 💪
Episode source code: https://github.com/corsego/151-dialog-turbo-modals/commit/6f4869005c28aca372319cc4f0f9e7e1ddd8a0e1
Based on this blogpost: https://blog.corsego.com/turbo-modal-dialog#refactoring
0:00 old implementation
0:38 I AM SORRY
1:12 move modal dialog from body to new.html.erb
5:40 reusable dialog wrapper
7:59 restrict opening modals in new tabs
0
Sign in to join the conversation
Recommended based on what you are watching now
28:57
Free Live talk: Hotwire, ViewComponent, StimulusJS in production (my experience )
10/09/2022 (over 1 year ago)
16:43
Free Ruby on Rails #100 Browser tab title notifications
27/12/2022 (over 1 year ago)
turbo rails
tab notifications
server side rendering
browser api
turbo broadcasts