Module: LinkHelper

Included in:
ArtfullyOseHelper
Defined in:
app/helpers/link_helper.rb

Instance Method Summary collapse

Instance Method Details

#active?(section) ⇒ Boolean

Returns:

  • (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


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
   :li, link_to(text, url), :class => (condition && 'active')
end

#active_sectionObject



10
11
12
# File 'app/helpers/link_helper.rb', line 10

def active_section
  content_for(:_active_section)
end


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

   :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

Returns:

  • (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