我正在尝试link_to
按钮操作
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#newTag">
<i class="fa fa-plus"></i> New Tag
</button>
我想将其作为path:
传递给此代码:
<%= render "shared/empty_view", path: contacts_path, title: "You do not have any tags!", action:"Create Tag", image: "/no_products.png" %>
我尝试过针对类似问题的类似答案,但我似乎无法获得正确的语法。
答案 0 :(得分:4)
<%= link_to "#newTag", data: { toggle: "modal" } do %>
<i class="fa fa-plus"></i> New Tag
<% end %>
<div id="newTag" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>