I'm having a problem with Twitter bootstrap & Rails data-remote link.
I load the modal content with data-remote="/path/to/data"
. Everything works as I want BUT create two requests.
= link_to '#myModal', 'Click here', data: {toggle: 'modal', remote: '/path'}
The first is rails data-reomte who makes a request to the page I'm at and after that bootstrap makes his requets and the modal is shown.
Is there any way I can turn of rails remote on specified links or is it actually another problem?
According to Bootstrap doc on Modal: http://twitter.github.io/bootstrap/javascript.html#modals
if you're using the data api, you may alternatively use the href tag to specify the remote source. An example of this is shown below:
<a data-toggle="modal" href="remote.html" data-target="#modal">click me</a>
So, your request can be fulfilled by disable Rails UJS data api and use Bootstrap's. Like this
<a data-toggle="modal" href="remote.html" data-target="#modal"
data-remote="false">click me</a>
In your case. The server side code
= link_to 'Click here', '/path_for_bootstrap',
data: {toggle: 'modal', remote: false, target: "#myModal"}
Update Or better, no need to define remote
at all because nobody need it, either Bootstrap or UJS!
= link_to 'Click here', '/path_for_bootstrap',
data: {toggle: 'modal', target: "#myModal"}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With