public
Description: A plugin to make rails menus easier to write
Homepage:
Clone URL: git://github.com/danielharan/semantic-menu.git
name age message
file MIT-LICENSE Sat Oct 25 14:58:48 -0700 2008 Add name in license [Daniel Haran]
file README Wed May 20 12:45:02 -0700 2009 fix doc to reflect actual behaviour; parents do... [Daniel Haran]
file Rakefile Thu Oct 23 20:34:25 -0700 2008 first commit [Daniel Haran]
file TODO Mon Oct 27 11:02:08 -0700 2008 removing procs from todo [Daniel Haran]
file init.rb Thu Oct 23 20:34:25 -0700 2008 first commit [Daniel Haran]
file install.rb Thu Oct 23 20:34:25 -0700 2008 first commit [Daniel Haran]
directory lib/ Wed Sep 16 13:50:55 -0700 2009 sync up with current_page? helper, to handle ex... [Daniel Haran]
directory public/ Fri May 22 07:24:11 -0700 2009 Added some basic CSS. [fsbrainstorm]
directory tasks/ Thu Oct 23 20:34:25 -0700 2008 first commit [Daniel Haran]
directory test/ Wed Sep 16 13:50:55 -0700 2009 sync up with current_page? helper, to handle ex... [Daniel Haran]
file uninstall.rb Thu Oct 23 20:34:25 -0700 2008 first commit [Daniel Haran]
README
= SemanticMenu

A plugin to make large menus easier to write.

Supports arbitrarily deep nesting; parents will be marked as 'active' if any of its children are active.

== Example

<%= semantic_menu do |root|
  root.add "overview", root_path
  root.add "comments", comments_path
end %>

Assuming you are on /comments, the output would be:

<ul class="menu">
  <li>
    <a href="/">overview</a>
  </li>
  <li class="active">
    <a href="/comments">comments</a>
  </li>
</ul>

add and semantic_menu both take an optional parameter hash, and you can nest the menu as deeply as you want:

<%= semantic_menu :class => 'top_level_nav' do |root|
  root.add "overview", "root_path"
  root.add "comments", "comments_path", :class => 'button' do |comments|
    comments.add "My Comments", "my_comments_path"
    comments.add "Recent",      "recent_comments_path"
  end
end %>

This would look like this:

<ul class="top_level_nav">
  <li>
    <a href="root_path">overview</a>
  </li>
  <li class="active">
    <a href="comments_path" class="button">comments</a>
    <ul class="menu_level_1">
      <li class="active">
        <a href="my_comments_path">My Comments</a>
      </li>
      <li>
        <a href="recent_comments_path">Recent</a>
      </li>
    </ul>
  </li>
</ul>

Copyright (c) 2008 Daniel Haran, released under the MIT license