2013-04-17 4 views
0

다음 link_to_unless_current에 아이콘을 추가하는 방법이 있습니까? 현재와 ​​현재가 아닌 상태 모두에 추가해야합니다.haml을 사용하여 link_to_unless_current에 아이콘을 어떻게 추가합니까?

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 

u는 아이디어를 얻을 희망, (참고 :

= link_to_unless_current("Stats", stats_practice_path(current_user.practice)) do content_tag(:div, content_tag(:p, "Stats"), :class => "nav-active") end 

답변

0

난 당신이

예위한 도우미 메서드를 사용하여 생각 그냥 ..을 자신에 의해 테스트, 나는 그것이 작동해야한다고 :))

+0

나는 커스텀 도우미 메서드는 당신에게 가까이 있지 않지만 당신은 저에게 영감을주었습니다. – Richard

+0

도와 줘서 기쁩니다. 도우미 메서드를 게시 할 수 있다면 귀중한 것을 배울 수도 있습니다. :) – sameera207

관련 문제