Ruby on Rails

Sdílet
Vložit
  • čas přidán 8. 05. 2024
  • 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

Komentáře • 8

  • @ledockol
    @ledockol Před 5 měsíci +1

    Good refactoring, well done Yaroslav!
    There’s no limit to perfection!

  • @georgesimei
    @georgesimei Před 24 dny +1

    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
      @SupeRails  Před 11 dny

      UI rule #1 - do not display more than one modal at a time on a page.

  • @yaroslavbozhak9107
    @yaroslavbozhak9107 Před 5 měsíci +1

    Thanks. Good job !

  • @joseanchietadev
    @joseanchietadev Před 5 měsíci +1

    Thank you, your videos are great.

  • @timbd87
    @timbd87 Před 4 měsíci

    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

  • @oli2016
    @oli2016 Před 5 měsíci +1

    Really nice pattern just wrapping any modal content in that modal partial block. May have to steal that

    • @SupeRails
      @SupeRails  Před 5 měsíci

      faster, while nobody’s watching! 🥷🤫😁