我正在使用引导模式,我想在弹出窗口中列出员工详细信息,但是那不能正常工作。
index.html.erb
<a href="#" data-toggle="modal" data-target="#myModal-<%= current_user.id %>">
<%= image_tag("view.png",:size=>"30x30") %></a></td>
</tr>
<div class="modal fade" id="myModal-<%= current_user.id %>" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<div class="modal-body">
<strong>RollID:</strong>
<%= current_user.roll_id %>
</div>
application.html.erb
<title>EmployeeManagementSystem</title>
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= stylesheet_link_tag 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/css/bootstrap.min.css' %>
<%= stylesheet_link_tag "https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Roboto+Slab:400,700|Material+Icons" %>
<%= javascript_include_tag "http://ajax.aspnetcdn.com/ajax/jquery.validate/1.10.0/jquery.validate.min.js"%>
<%= yield %>
application.js
//= require activestorage
//= require jquery.validate
//= require jquery.validate.additional-methods
//= require rails-ujs
//= require turbolinks
//= require jquery
//= require jquery_ujs
//= require popper
//= require_tree .
gem文件https://imgur.com/a/RxWpe8v
请告诉我代码中的任何错误。还有另一种实现模式电话的方式。
谢谢前进
答案 0 :(得分:0)
您需要将bootstrap组件或bootstrap-sprockets.js包含到您的app / assets / javascripts / application.js文件中。由于引导程序取决于jquery,因此我会放在jquery之后。
//= require jquery
//= require bootstrap-sprockets