Ruby on Rails
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: github.com/corsego/151-dialog...
Based on this blogpost: blog.corsego.com/turbo-modal-...
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
Пікірлер: 8
Good refactoring, well done Yaroslav! There’s no limit to perfection!
Thank you, your videos are great.
Thanks. Good job !
This is great, i refactored to match some of this! i use a custom turbo action and animate.css to add animations - i've built modals and slideovers with animations
Really nice pattern just wrapping any modal content in that modal partial block. May have to steal that
@SupeRails
5 ай бұрын
faster, while nobody’s watching! 🥷🤫😁
First of all, thank you for the excellent videos; I'm learning so much from them! However, I have a question and would greatly appreciate your help. I've followed all the steps mentioned, but a question has arisen: If I need to add another modal to the same page, such as an additional form, is it possible to do this using the same turbo_frame in the application? Or do I need to code a separate turbo_frame_tag in the index for each modal, each with different IDs? Thanks for your attention.
@SupeRails
5 күн бұрын
UI rule #1 - do not display more than one modal at a time on a page.