Sha256: b01b0009f19fd8d3ad1af98be77fe8a5d49633cb8d5ab673ad9dff1af3172598

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

module LinkHelper
  def active?(section)
    "active" if content_for(:_active_section) == section.to_s || content_for(:_active_sub_section) == section.to_s
  end

  def in_section?(section)
    "in" if content_for(:_active_section) == section.to_s || content_for(:_active_sub_section) == section.to_s
  end

  def active_section
    content_for(:_active_section)
  end

  def in_section(section)
    content_for(:_active_section, section)
  end

  def in_sub_section(section)
    content_for(:_active_sub_section, section)
  end

  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
  
  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=#{icon}></i> #{text}".html_safe, link
    end 
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
artfully_ose-1.2.0.pre.23 app/helpers/link_helper.rb