如何将字形添加到 rails link_to helper - Bootstrap 3 [英] How to add glyphicons to rails link_to helper - Bootstrap 3

查看:42
本文介绍了如何将字形添加到 rails link_to helper - Bootstrap 3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在到处寻找有关如何将字形添加到 rails link_tobutton_to 助手的很好解释,但我发现的很少.到目前为止,我收集到的信息使我想到了这一点:

I've been looking everywhere for a good explanation of how to add glyphicons to rails link_to and button_to helpers, but I've found very little. What I've gathered so far has led me to this:

<li>
  <%= link_to deals_path, class: "btn btn-default" do %>
    <%= content_tag(:i, "Dasboard",:class=>' glyphicon, glyphicon-th-large') -%>
  <% end %>
</li>

但这不起作用,我认为我发现的一个例子来自 Bootstrap 2.谁能给我指出一个很好的资源,或者提供一个简单的例子?提前致谢!

This doesn't work though and I think the one example I found was from Bootstrap 2. Can anyone point me to a good resource on this, or provide a quick example? Thanks in advance!

推荐答案

我在这里找到了答案

rails 中字形链接的基本形式如下所示:

The basic form of a glyph link in rails looks like this:

<%= link_to deals_path, class: "btn btn-default" do %>
    <i class="glyphicon glyphicon-euro"></i> Dashboard
<% end %>

根据需要修改.该链接中的第二个示例对我不起作用,我假设是因为我使用的是 rails_bootstrap_sass gem?无论如何,上述表格对我有用.

Modify as needed. The second example in that link didn't work for me, I assume because I'm using the rails_bootstrap_sass gem? Regardless, the above form worked for me.

这篇关于如何将字形添加到 rails link_to helper - Bootstrap 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆