0

次の 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
4

1 に答える 1

0

これにはヘルパーメソッドを使用していると思います。

元:

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

(注:私はこれを自分でテストしていませんが、うまくいくはずです:))

于 2013-04-17T04:21:45.560 に答える