Skip to content

Instantly share code, notes, and snippets.

@gonzedge
Created January 3, 2012 23:18
Show Gist options
  • Select an option

  • Save gonzedge/1557508 to your computer and use it in GitHub Desktop.

Select an option

Save gonzedge/1557508 to your computer and use it in GitHub Desktop.
Generating your site menu with the 'simple-navigation' gem
navigation.items do |primary|
# ...
primary.item :menu_blog, 'Blog', posts_path, highlights_on: /\/blog/ do |blog|
blog.item :menu_popular, 'Popular', popular_posts_path
blog.item :menu_recent, 'Recent', recent_posts_path
end
# ...
end
navigation.items do |primary|
# ...
primary.item :menu_blog, 'Blog', posts_path, highlights_on: /\/blog/
# ...
end
rails generate navigation_config
gem 'simple-navigation'
SimpleNavigation::Configuration.run do |navigation|
navigation.selected_class = 'current'
navigation.items do |primary|
primary.item :menu_home, 'Home', root_path
primary.item :menu_about_us, 'About Us', about_us_path
primary.item :menu_blog, 'Blog', posts_path
primary.item :menu_contact_us, 'Contact Us', contact_us_path
end
end
<%= render_navigation %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment