README.md in rails_crumbs-0.0.2 vs README.md in rails_crumbs-1.0.0
- old
+ new
@@ -1,25 +1,119 @@
# Railscrumbs
-TODO: Write a gem description
+*Railscrumbs* a simple Breadcrumbs navigation plugin for rails.
+## Requirements
+* rails >= 3.1
+
## Installation
Add this line to your application's Gemfile:
- gem 'Railscrumbs'
+ gem 'rails_crumbs'
And then execute:
- $ bundle
+ $ bundle install
Or install it yourself as:
- $ gem install Railscrumbs
+ $ gem install rails_crumbs
## Usage
-TODO: Write usage instructions here
+In your controller, call `set_railscrumb` to push s new element to Railscrumbs stack.
+
+ class MyController < ApplicationController
+
+ def index
+ set_railscrumb 'My Controller', mycontroler_path
+ ...
+ end
+
+ end
+
+Or if you can only some methods
+
+ class MyController < ApplicationController
+ set_railscrumb 'Home', :root_path
+ set_railscrumb 'My Controller', :some_path, :only => [:index, :new]
+
+ def index
+ ...
+ end
+
+ def show
+ @anything = ....
+ set_railscrumb @some.name, anything_path(@anything)
+
+ ...
+ end
+
+ def new
+ ...
+ end
+ end
+
+to render the Railscrumb you can call on the `application.html.erb` file to Railscrumbs stack.
+
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title>My Title</title>
+ </head>
+ <body>
+ <% @railscrumbs.each do |crumb| %>
+ <span><strong><%= crumb.name %></strong>
+ <%= ' >> ' unless crumb == @railscrumbs.last %></span>
+ <% end %>
+
+ <%= yield %>
+ </body>
+ </html>
+
+### Arguments
+
+*set_railscrumb* requires two arguments:
+
+
+*`name`: Name of the breadcrumb
+
+*`path`: Target path, if your railscrumb are out of a method, you have to use a symbol (e.g :root_path ). in a method like 'show', you can use the helper method (e.g user_path(@user) or users_path )
+
+
+#### optional arguments:
+
+`only` the specification of the controller methods for the breadcrumb
+
+
+#### custom arguments:
+
+if you wanna have custom value for your breadcrumbs, you can pass the argument like `:custom => 'some value`
+and use like `<%= @railscrumbs.first.custom %> `, this show 'some value'
+
+
+for example if you wanna specify a icon value for the css you can pass like this
+
+ class MyController < ApplicationController
+
+ def index
+ set_railscrumb 'My Controller', mycontroler_path, :icon => 'mycontroller'
+
+ ...
+ end
+
+ end
+
+and in `application.html.erb`:
+
+ <% @railscrumbs.each do |crumb| %>
+ <span><strong><i class="icon-<%= crumb.icon %>"></i><%= crumb.name %></strong>
+ <%= ' >> ' unless crumb == @railscrumbs.last %></span>
+ <% end %>
+
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)