我正在尝试将表单标记和字体添加到以下格式:
<%= form_tag(controller: "maps", action: "favorite", method: "post"%>
<%= submit_tag "Favorite"%>
我试过这种方式并没有发生任何事情,它仍然看起来像下图中的灰色按钮。我正在尝试替换图像中的绿色收藏夹按钮,该按钮也具有字体真棒图标。
<%= form_tag(controller: "maps", action: "favorite", method: "post")%>
<%= submit_tag "Favorite",html: { class: 'btn-u btn-u-lg rounded-4x btn-u-green' }%>
这是我的完整代码和图片:
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<!--Basic Table-->
<div class="panel panel-green margin-bottom-40">
<div class="panel-heading">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<div class = "name"></div>
</div>
<div class="panel-body">
<div id="map2" style='width: 568px; height: 365px;'></div>
<div class="row">
<div class="col-sm-12 text-center">
<button class="btn-u btn-u-lg rounded-4x btn-u-green" type="button"><i class="fa fa-check-circle" aria-hidden="true"></i> Check Availability</button>
<button class="btn-u btn-u-lg rounded-4x btn-u-green" type="button"><i class="fa fa-plus-circle" aria-hidden="true"></i> Add to Favorites</button>
<%= form_tag(controller: "maps", action: "favorite", method: "post")%>
<%= submit_tag "Favorite",html: { class: 'btn-u btn-u-lg rounded-4x btn-u-green' }%>
</div>
</div>
</div>
<table class="table paneltb">
</table>
</div>
<!--End Basic Table-->
</div>
</div>
答案 0 :(得分:0)
对于其他可能会偶然发现此问题的人,我认为不可能将超棒的字体图标与form_tag链接起来。我可以通过link_to标签来做到这一点。
在上面的示例代码Jermaine Subia中,我认为它看起来像这样:
BackgroundWorker.RunWorkerAsync
这是我刚刚实现的一些示例代码,我知道它们是有效的:
<%= link_to(favorite_maps_path, method: "post") do %>
<i class="fa fa-heart" title="Favorite"></i>
<% end %>
此外,在上面的示例中,我向操作传递了许多参数,此外,您不需要 <%= link_to(user_jobs_path(user_job: {title: job.title, company: job.company, url: job.url, description: job.description, user_id: current_user}), method: "post") do %>
<i class="fa fa-heart" title="Save to my jobs"></i>
<% end %>
属性,我认为这只是将鼠标悬停在图标上时看到的文本。希望这可以帮助某人!