Module: LinkHelper
- Included in:
- ArtfullyOseHelper
- Defined in:
- app/helpers/link_helper.rb
Instance Method Summary collapse
- #active?(section) ⇒ Boolean
- #active_link_to(text, url = '#', condition = nil) ⇒ Object
- #active_section ⇒ Object
- #calendar_active_link_to(text, link, condition = nil, icon) ⇒ Object
- #in_section(section) ⇒ Object
- #in_section?(section) ⇒ Boolean
- #in_sub_section(section) ⇒ Object
Instance Method Details
#active?(section) ⇒ Boolean
2 3 4 |
# File 'app/helpers/link_helper.rb', line 2 def active?(section) "active" if content_for(:_active_section) == section.to_s || content_for(:_active_sub_section) == section.to_s end |
#active_link_to(text, url = '#', condition = nil) ⇒ Object
22 23 24 25 26 27 |
# File 'app/helpers/link_helper.rb', line 22 def active_link_to(text, url='#', condition=nil) if condition.nil? and String === url condition = url == request.path end content_tag :li, link_to(text, url), :class => (condition && 'active') end |
#active_section ⇒ Object
10 11 12 |
# File 'app/helpers/link_helper.rb', line 10 def active_section content_for(:_active_section) end |
#calendar_active_link_to(text, link, condition = nil, icon) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'app/helpers/link_helper.rb', line 29 def calendar_active_link_to(text, link, condition=nil, icon) if condition.nil? and String === link condition = link == request.path end content_tag :li, :class => (condition && 'active') do link_to "<i class='fa #{icon} icon-gray'></i> #{text}".html_safe, link end end |
#in_section(section) ⇒ Object
14 15 16 |
# File 'app/helpers/link_helper.rb', line 14 def in_section(section) content_for(:_active_section, section) end |
#in_section?(section) ⇒ Boolean
6 7 8 |
# File 'app/helpers/link_helper.rb', line 6 def in_section?(section) "in" if content_for(:_active_section) == section.to_s || content_for(:_active_sub_section) == section.to_s end |
#in_sub_section(section) ⇒ Object
18 19 20 |
# File 'app/helpers/link_helper.rb', line 18 def in_sub_section(section) content_for(:_active_sub_section, section) end |