引导模态在rails中非功能



(我知道有一堆这样的问题,但似乎没有一个能回答我的具体情况。)

我试图在Rails视图中显示一个引导模态,但是关联的按钮根本不做任何事情-单击它除了按钮交互效果之外没有任何影响。据我所知,bootstrap一般设置为正常工作;这似乎不是我的问题。

Modal html,其中大部分是直接从bootstrap文档中复制过来的:

<div id="new_event">
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#new-event-modal">+</button>
<div id="new-event-modal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">add an event!</h4>
</div>
<div class="modal-body">
Text! <!--form goes here -->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">cancel</button>
</div>
</div>
</div>
</div>
</div>

我的custom.scss@import "bootstrap-sprockets"; @import "bootstrap",application.js//= require bootstrap-sprockets。其他javascript的东西工作得很好,其他的bootstrap的东西也工作得很好。我遗漏了什么?

这是行不通的。如果你正在使用Rails 6,有一个非常具体的方法来添加Bootstrap到你的Rails应用程序。我已经在github上描述了它:https://github.com/overdrivemachines/bootstrap-rails

最新更新