Simple Navigation for Bootstrap
This gem adds a renderer for Simple Navigation to output markup compatible with materialize.
Getting Started
For Rails >= 3, simply add this gem to your Gemfile
:
gem 'simple-navigation-materialize'
and run
bundle install
Follow the configuration instructions on the Simple Navigation wiki for initial configuration.
To use the Materialize renderer, specify it in your view:
:renderer => :materialize
See below for a more complete example.
Additional Functionality
Icons
In addition you may specify an :icon
attribute on your navigation items, either as an array
or string, containing materialize icon names, to add an icon to the item.
Dropdowns
If you wish to use dropdowns in your navbar, don't forget to set expand_all: true
on your render_navigation
.
Examples
To create a navigation menu, you might do something like this:
SimpleNavigation::Configuration.run do ||
.items do |primary|
primary.item :music, 'Music', musics_path
primary.item :dvds, 'Dvds', dvds_path, :split => true do |dvds|
dvds.item :action, 'Action', dvds_action_path
dvds.item :drama, 'Drama', dvds_drama_path
end
primary.item :books, 'Books', :icon => 'book' do |books|
books.item :fiction, 'Fiction', books_fiction_path
books.item :history, 'History', books_history_path
end
end
end
Further Reading
Contributions
- Simple Navigation for Bootstrap for the base of this code