# Breadcrumble [![Build Status](https://secure.travis-ci.org/ma2gedev/breadcrumble.png?branch=master)](http://travis-ci.org/ma2gedev/breadcrumble) Breadcrumble is a simple breadcrumb navigation plugin for Ruby on Rails 3 and Rails 4.0. ## Installation Add this line to your application's Gemfile: gem 'breadcrumble' And then execute: $ bundle Or install it yourself as: $ gem install breadcrumble ## Usage ### Controller In your controller, call `add_breadcrumb` to push a new crumb on the breadcrumb stack. class SampleController add_breadcrumb "home", home_url add_breadcrumb -> context { context.title }, -> context { context.sample_path } def index add_breadcrumb "index", controller: 'sample', action: 'index' add_breadcrumb "show", show_path(123) add_breadcrumbs ["book", "/book"], ["page", "/book/page"] end end Second arugment passed url_for method for convenient use, except specify nil. You can use Proc object for arguments, the library calls proc with controller context as argument. If you would like to use multiple breadcrumb, call `add_breadcrumb_to` method with breadcrumb trail index. class SampleController add_breadcrumb_to "level 1", "level 1 url", 0 # same as -> add_breadcrumb "level 1", "level 1 url" add_breadcrumb_to "level 2", "level 2 url", 1 def index add_breadcrumb "level 1 second item", "level 1 second url", 0 add_breadcrumb "level 2 second item", "level 2 second url", 1 end ### View In your view, you can render the breadcrumb navigation with the `render_breadcrumbs` helper. <%= render_breadcrumbs %> You can render multiple breadcrumb by `render_breadcrumb_trails` helper. <%= render_breadcrumb_trails %> ### Customizing layout Breadcrumble generates default partial template for your app. Generate template. Run the follwoing. $ rails g breadcrumble:views then edit the partials in your app's `app/views/breadcrumble/` directory. ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Added some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request