我按照该示例编写了带有模式弹出的Rails应用程序。Rails 4中的Bootstrap模式不会弹出
这是代码我有(相当几行)
index.html.erb
<h1>Listing people</h1>
<%= link_to 'Add Person Modal', new_test_path,
{:remote => true, 'data-toggle' => "modal", 'data-target' => '#modal-window'} %>
<div id="modal-window" class="modal hide fade in" role="dialog"
aria-hidden="true" style="display: none; "></div>
_new_test.html.erb
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Modal header</h3>
</div>
<div class="modal-body">
**here comes whatever you want to show!**
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button class="btn btn-primary">Save changes</button>
</div>
people_controller.rb
def new_test
respond_to do |format|
format.html
format.js
end
end
new_test.js.erb
// $("modal-window").modal();
$("#modal-window").html("<%= escape_javascript(render 'people/new_test') %>");
任何帮助理解!!
看起来你缺少一些依赖关系。至少,我没有看到你包含Bootstrap CSS(它看起来不是CSS包的一部分)。 – 2014-09-04 18:24:57
啊,好吧,我添加了CSS不。现在点击我看到屏幕淡入,但模态不显示。我更新了heroku链接 – harshit 2014-09-04 18:40:29