涡轮链接问题与引导模式 [英] turbolinks issues with bootstrap modal
问题描述
我做这样的模态:
显示模态的链接:
<%= link_to "versão resumida", resumed_rep_life_animal_path(animal, :partial => true), 'data-toggle' =>'模态', '数据目标' =>'#myModal', 'data-no-turbolink' =>真%>
模态 html 本身:
<div class="modal hidefade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"><div class="modal-body"></div><div class="modal-footer"><button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Fechar</button>
但是,data-no-turbolink
没有按预期工作.如果我刷新页面,它可以正常工作,但是,当我使用 turbolinks 浏览页面时,看起来 data-no-turbolink
被忽略了.
我做错了吗?我在我的应用程序中有一些像示例一样的模式,不想删除它们,也不想删除 turbolinks...
提前致谢.
data-no-turbolinks 不是这里的问题...
看起来bootstrap js开箱即用只监控document.ready,并且bootstrap JS可能需要修改以检查page:load
这只会在包含引导程序的第一个请求上触发.它也需要修改为在 page:load 上触发.
我可以提出的一个建议是使用 gem 'twitter-bootstrap-turbo' 来获取引导程序.这是 twitter-bootstrap-rails 的分支,添加了 turbolinks 处理程序.
I doing a modal like this:
Link that shows the modal:
<%= link_to "versão resumida", resumed_rep_life_animal_path(animal, :partial => true), 'data-toggle' => 'modal', 'data-target' => '#myModal', 'data-no-turbolink' => true %>
Modal html itself:
<div class="modal hide fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-body"></div>
<div class="modal-footer">
<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Fechar</button>
</div>
</div>
But, the data-no-turbolink
dont work as expected. If I refresh the page, it works ok, but, when I browse the pages with turbolinks, looks like the data-no-turbolink
is just ignored.
Am I doing something wrong? I have some modals like the example in my app, don't want to remove them and dont want to remove turbolinks neither...
Thanks in advance.
data-no-turbolinks is not the issue here...
It appears bootstrap js out of the box monitors only document.ready, and bootstrap JS may need modified to check for page:load as well
This will only fire on the first request in which bootstrap is included. It needs modified to fire on page:load as well.
One suggestion I can make is to use gem 'twitter-bootstrap-turbo' for getting bootstrap. This is a fork of twitter-bootstrap-rails , with the addition of turbolinks handlers.
这篇关于涡轮链接问题与引导模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!