turbolinks issues with bootstrap modal

后端 未结 2 1136
后悔当初
后悔当初 2020-12-16 01:10

I doing a modal like this:

Link that shows the modal:

<%= link_to \"versão resumida\", resumed_rep_life_animal_path(animal, :partial => true)         


        
2条回答
  •  渐次进展
    2020-12-16 01:59

    As davydotcom said, the reason the modals aren't working is because they are bound to $(document).ready instead of $(document).on('page:change'), which is what turbolinks uses.

    The jquery-turbolinks gem will make it so that ready calls will also respond to turbolink's page:change calls.

    Step 1: Add gem jquery-turbolinks to your Gemfile.

    Step 2: Add it to your JavaScript manifest file, in this order:

    //= require jquery
    //= require jquery.turbolinks
    //= require jquery_ujs
    //
    // ... your other scripts here ...
    //
    //= require turbolinks
    

    Step 3: Restart your server. Boom!

提交回复
热议问题