laktek / simple-menu

Full Flexibile menu helper for Rails apps. Supports current tab highlighting, muliple menus and conditional tabs

This URL has Read+Write access

name age message
file README.markdown Wed Mar 25 07:15:20 -0700 2009 markdown formatted readme [laktek]
file init.rb Tue Mar 24 09:17:10 -0700 2009 extracted to a plugin [laktek]
directory lib/ Thu Jul 02 03:51:08 -0700 2009 now you can use within erb [laktek]
directory spec/ Tue Mar 24 09:17:10 -0700 2009 extracted to a plugin [laktek]
README.markdown

Simple Menu Plugin for Rails

This is still under active development. Feel free to fork and hack.

Features

  • Possible to have muliple menus in same page
  • Current Tab selection (set the @current_tab with the tab(s) you want to select for current controller/action.)
  • Automatic URL derivation.
  • Customize the URL, link text (supports html tags)
  • Supports html options. Specify custom ids and classes
  • Provide a custom seperator

Some example cases

  1. menu_tag :main-menu, :seperator => "|" do |menu|
      if current_user
        menu.item :settings, :url => account_path
        menu.item :help, :url => "#"
        menu.item :sign_out
      else
        menu.item :signup, :text => "Create an account", :url => new_user_path
        menu.item :sign_in, :url => new_user_session_path 
      end
    end
    
  2.   menu_tag :manage, :class => "sidemenu" do |menu|
      menu.item :clients, :text => "<strong>Clients</strong><br/>Your contacts &amp; address book"
      menu.item :items, :text => "<strong>Items</strong><br/>Tasks, products and services"
    end