Sha256: b4e61effdaab6ac2ce1c0fca66670469859b9b7b8ebec91310766abb129196ba

Contents?: true

Size: 752 Bytes

Versions: 14

Compression:

Stored size: 752 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 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
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
artfully_ose-1.2.0.pre.21 app/helpers/link_helper.rb
artfully_ose-1.2.0.pre.20 app/helpers/link_helper.rb
artfully_ose-1.2.0.pre.19 app/helpers/link_helper.rb
artfully_ose-1.2.0.pre.18 app/helpers/link_helper.rb
artfully_ose-1.2.0.pre.17 app/helpers/link_helper.rb
artfully_ose-1.2.0.pre.16 app/helpers/link_helper.rb
artfully_ose-1.2.0.pre.15 app/helpers/link_helper.rb
artfully_ose-1.2.0.pre.12 app/helpers/link_helper.rb
artfully_ose-1.2.0.pre.11 app/helpers/link_helper.rb
artfully_ose-1.2.0.pre.10 app/helpers/link_helper.rb
artfully_ose-1.2.0.pre.9 app/helpers/link_helper.rb
artfully_ose-1.2.0.pre.8 app/helpers/link_helper.rb
artfully_ose-1.2.0.pre.7 app/helpers/link_helper.rb
artfully_ose-1.2.0.pre.6 app/helpers/link_helper.rb