Sha256: 6e9bc25b66049c5fe1869ce2968566609d8cc4b8b0497aca0f2fead9d8dc300b

Contents?: true

Size: 607 Bytes

Versions: 5

Compression:

Stored size: 607 Bytes

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 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
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
artfully_ose-1.1.0 app/helpers/link_helper.rb
artfully_ose-1.1.0.rc2 app/helpers/link_helper.rb
artfully_ose-1.1.0.rc1 app/helpers/link_helper.rb
artfully_ose-1.0.0.rc4 app/helpers/link_helper.rb
artfully_ose-1.0.0.rc3 app/helpers/link_helper.rb