多个字体真棒图标作为Rails链接 [英] multiple font awesome icons as rails link

查看:82
本文介绍了多个字体真棒图标作为Rails链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下令人敬畏的字体行,它是可点击的链接

I have the following font-awesome line that is a clickable link

%p.add_stuff= link_to(content_tag(:i, nil, class: "fa fa-plus"), new_journey_trip_path(@journey))

除了fa-plus外,我还要添加另一个字体超赞的加号图标(因此它看起来像+ +).我该如何实现?

In addition to fa-plus, I'd like to add another font-awesome plus icon (so it appears something like + + ). How do I achieve this?

我已经尝试过两次调用fa-plus,并且创建了两个content_tag,但似乎都没有用.

I've tried calling fa-plus two times, as well as making two content_tag, but neither seems to work.

推荐答案

通过link_to,您可以嵌套内容

with link_to, you can nest the contents

%p.add_stuff
  = link_to new(journey_trip_path(@journey)) do
    = content_tag(:i, nil, class: "fa fa-plus")
    = content_tag(:i, nil, class: "fa fa-plus")

%p.add_stuff
   = link_to new(journey_trip_path(@journey)) do
     %i.fa.fa-plus
     %i.fa.fa-plus

或者,您可能具有fa_icon方法可用...

or, you may have the fa_icon method available...

%p.add_stuff
  = link_to new(journey_trip_path(@journey)) do
    = fa_icon('plus')
    = fa_icon('plus')

这篇关于多个字体真棒图标作为Rails链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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