Sha256: aebf9cfb4af8fe79b2f65e25992f48286178ae9ad30189558593ff1dee6c7d2c

Contents?: true

Size: 931 Bytes

Versions: 21

Compression:

Stored size: 931 Bytes

Contents

NAME
  rails_nav.rb

SYNOPSIS
  encapsulates only the concept of a

    "named list of linkys"

  and

    "how to make one 'em active"

  it does *not* to any htmly stuff for you


USAGE

  in a controller

    class ApplicationController < ActionController::Base

      nav_for :main do |list|
        if current_user
          list.link(:home, root_path)
          list.link(:test, test_path)
        end

        if current_user.admin?
          list.link(:admin, admin_path)
        end
      end

    end

    # pass a block to list.link(...){ } to supply logic for when a link is
    # active.  otherwise a sane default will be built for you.

  in a view

    <%=

      nav_{
        ul_(:class => 'nav nav-pills'){
          nav_for(:main).each do |link|

            li_(:class => (link.active ? :active : :inactive)){
              a_(:href => link.href){ link }
            }

          end
        }
      }

    %>

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
rails_nav-2.8.0 README
rails_nav-2.7.0 README
rails_nav-2.6.0 README
rails_nav-2.5.7 README
rails_nav-2.5.6 README
rails_nav-2.5.5 README
rails_nav-2.5.4 README
rails_nav-2.5.3 README
rails_nav-2.5.2 README
rails_nav-2.5.1 README
rails_nav-2.5.0 README
rails_nav-2.4.0 README
rails_nav-2.3.0 README
rails_nav-2.2.0 README
rails_nav-2.0.0 README
rails_nav-1.3.1 README
rails_nav-1.3.0 README
rails_nav-1.2.0 README
rails_nav-1.1.0 README
rails_nav-1.0.1 README