Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rails_nav

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rails_nav

  • 2.8.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

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

%>

FAQs

Package last updated on 07 Sep 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc