次の link_to_unless_current にアイコンを追加する方法はありますか? 現在の状態とそうでない状態の両方に追加する必要があります。
= link_to_unless_current("Stats", stats_practice_path(current_user.practice)) do content_tag(:div, content_tag(:p, "Stats"), :class => "nav-active") end
次の link_to_unless_current にアイコンを追加する方法はありますか? 現在の状態とそうでない状態の両方に追加する必要があります。
= link_to_unless_current("Stats", stats_practice_path(current_user.practice)) do content_tag(:div, content_tag(:p, "Stats"), :class => "nav-active") end
これにはヘルパーメソッドを使用していると思います。
元:
module ApplicationHelper
def icon(image = "youricon.png")
raw(image_tag(image))
end
end
そしてあなたの見解では:
= link_to_unless_current(icon, stats_practice_path(current_user.practice)) do content_tag(:div, content_tag(:p, "Stats"), :class => "nav-active") end
(注:私はこれを自分でテストしていませんが、うまくいくはずです:))