Ask A Question

Notifications

You’re not receiving notifications from this thread.

Custom Turbo Confirm Modals with Hotwire in Rails Discussion

Thanks for this

Reply

Any insider info on when your PR for this is going to be shipped/released?
https://github.com/hotwired/turbo/pull/525/files

Reply

Ya I'm waiting for turbo to be tagged and released as well, how do we reference a github ref for rails to correctly build the js with a branched lib? I'm still confused about how to get the correct versions of JS libs in my app with npm, yarn, and importmaps all playing some part in managing the libs.

Reply

Can anyone provide any tips on how to make it so the rails-turbo gem uses the edge version of the @hotwired/turbo NPM dependency? They haven't released a new version of turbo for about 9 months and along with this update that Chris made, there are numerous other fixes.

Reply

I was able to get it work by adding a dependency to the latest turbo build in my package.json using the hotwired/dev-builds branch

I added the following then ran yarn install -f

    "@hotwired/turbo": "hotwired/dev-builds#@hotwired/turbo/latest",
Reply

This broke every turbo_stream_from tag I had in the app. As in, the frontend wouldn't be listen to updates over the cable. Have you found a workaround for that?

Reply

pls can anyone help me here, I used turbo approach cos I need modal/bootsrap for the project but the FORM hardly show on web page and the item get deleted immediately without confirmation, anybody??

Reply

Hello there I've been trying to make custom turbo_confirm modal and i noticed a problem, the modal pops up for a second and thing gets deleted I don't even have time to confirm it or cancel.

Reply

I used this snippet to close the dialog when someone clicks the backdrop.

dialog.addEventListener('click', (event) => {
  if (event.target.nodeName === 'DIALOG') {
    dialog.close();
  }
});

From here:
https://www.stefanjudis.com/blog/a-look-at-the-dialog-elements-super-powers/

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 87,400+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.