Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Provides a Library to allow you to create a dynamic menu
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
.project
Gemfile
Gemfile.lock
MIT-LICENSE
README.md
Rakefile
dynamic_menu-3.0.0.gem
dynamic_menu-3.0.1.gem
dynamic_menu.gemspec

README.md

Dynamic_Menu

As of versions >= 3.0.0 dynamic_menu has drastically changed. Menus are now in their own folder and can inherit routes from each other.

Installing

Gemfile:

gem "dynamic_menu","~>3.0.0"

Console:

rails g dynamic_menu:install

Now your application's structure should be setup to allow the use of dynamic_menu.

Generating a menu

To generate the base class for your menu you can go to the console and type:

rails g dynamic_menu::menu controller:action

for example:

rails g dynamic_menu users::new

You will find your menus in app/menus. There you can add or change what you need. Use add to add a new link.

add link_to "Google","http://google.com"

If you want to inherit from another menu within the same folder (same controller) use:

inherit_from "name-of-other-menu"  #put in the build_menu command.

Your view:

#Consider putting this in your layout to make it easier!
<ul>
<% get_current_menu.get_menu_links.each do |link| %>
    <li><%= link %></li>
</ul>
Something went wrong with that request. Please try again.