Sha256: 8ee3361de9e003b46b9952057cdc997035e1daa185ad19576605128d5e948ef5

Contents?: true

Size: 1.03 KB

Versions: 11

Compression:

Stored size: 1.03 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='fa #{icon} icon-gray'></i> #{text}".html_safe, link
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
artfully_ose-1.3.0.pre4 app/helpers/link_helper.rb
artfully_ose-1.3.0.pre3 app/helpers/link_helper.rb
artfully_ose-1.3.0.pre2 app/helpers/link_helper.rb
artfully_ose-1.3.0.pre1 app/helpers/link_helper.rb
artfully_ose-1.2.0 app/helpers/link_helper.rb
artfully_ose-1.2.0.beta.1 app/helpers/link_helper.rb
artfully_ose-1.2.0.alpha.2 app/helpers/link_helper.rb
artfully_ose-1.2.0.alpha.1 app/helpers/link_helper.rb
artfully_ose-1.2.0.pre.27 app/helpers/link_helper.rb
artfully_ose-1.2.0.pre.26 app/helpers/link_helper.rb
artfully_ose-1.2.0.pre.24 app/helpers/link_helper.rb