我的productions_helper.rb中有一个ruby函数:
def new_applications(number, new_castings_for_user)
content_tag :span, "(#{number})", class: "icon-new-applications#{' highlight' if new_castings_for_user}"
end
我添加了一个很棒的字体图标:
def new_applications(number, new_castings_for_user)
content_tag :span, "(#{number})", fa_icon: "user-plus", class: "icon-new-applications#{' highlight' if new_castings_for_user}"
end
但是,该图标未显示在我的网站上。有人可以告诉我我做错了什么吗?
好吧,您实际上并没有渲染图标。在您的代码中,您所要做的就是向fa_icon
span标签添加一个属性。除非有一些其他代码可以解释此属性,否则它将无法正常工作。试试这个
def new_applications(number, new_castings_for_user)
content_tag :span, class: "icon-new-applications#{' highlight' if new_castings_for_user}" do
[content_tag(:i, "", class: "fa fa-user-plus"), "(#{number})"].join.html_safe
end
end
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句