Sha256: 001786ad319061ba2b07a757b36d9180e57c802660a5cff774ebdb23e5a093fc

Contents?: true

Size: 546 Bytes

Versions: 1

Compression:

Stored size: 546 Bytes

Contents

module NavigationHelper
  def nav_link(text, link_path, options = {}, &block)
    link_options = options.fetch(:link_options, {})
    link_options[:class] = link_classes(link_path, link_options)
    list_options = options.fetch(:list_options, {})

    inner = capture(&block)
    content_tag(:li, list_options) do
      concat(link_to(text, link_path, link_options)).concat( block_given? ? inner : "" )
    end
  end

  private

  def link_classes(link_path, options)
    current_page?(link_path) ? options.fetch(:class, "active") : ""
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bootstrap_toolbelt-0.0.8 app/helpers/navigation_helper.rb