#153 Refactoring Hotwire Modals
21/11/2023
Free
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
![#138 Responsive Layout with Sidebar and Navbar](https://superails.com/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MTg5MCwicHVyIjoiYmxvYl9pZCJ9fQ==--20f38afc454180eb5a08327b9629d846e64c1849/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJqcGciLCJyZXNpemVfdG9fbGltaXQiOls0MDAsNjAwXX0sInB1ciI6InZhcmlhdGlvbiJ9fQ==--2d7cd3a4d9675c7f4c17dad7856d799792bd3595/maxresdefault.jpg)
16:57
#138 Responsive Layout with Sidebar and Navbar
08/08/2023
Free
1
![#58 Nested Resources](https://superails.com/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MTgxNCwicHVyIjoiYmxvYl9pZCJ9fQ==--0a005e599238299171ec761c9e9ff443f62c9f27/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJqcGciLCJyZXNpemVfdG9fbGltaXQiOls0MDAsNjAwXX0sInB1ciI6InZhcmlhdGlvbiJ9fQ==--2d7cd3a4d9675c7f4c17dad7856d799792bd3595/maxresdefault.jpg)
17:58
#58 Nested Resources
18/10/2021
Free
![#150 Global Search](https://superails.com/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MTk0NSwicHVyIjoiYmxvYl9pZCJ9fQ==--2476c8761d99308f56f56d348eaba4dbd0e2b820/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJqcGciLCJyZXNpemVfdG9fbGltaXQiOls0MDAsNjAwXX0sInB1ciI6InZhcmlhdGlvbiJ9fQ==--2d7cd3a4d9675c7f4c17dad7856d799792bd3595/maxresdefault.jpg)
24:29
#150 Global Search
09/11/2023
Free
1