README.rdoc in loaf-0.1.0 vs README.rdoc in loaf-0.1.1
- old
+ new
@@ -1,48 +1,63 @@
-= loaf
+= Loaf
Breadcrumbs creation library.
-* Helps in creating breadcrumbs.
-* Uses controllers to specify names and routes for parts of breadcrum trails or collections of breadcrumbs.
-* Stays out of your way when it comes to markup exposing only single helper method to access breadcrumb data.
+* Helps in creating breadcrumbs.
+* Uses controllers to specify names and routes for parts of breadcrum trails or collections of breadcrumbs.
+* Stays out of your way when it comes to markup exposing only single helper method to access breadcrumb data.
== Installation
Install from source:
-
+
gem install loaf
Add to your Gemfile:
-
+
gem 'loaf'
== Configuration
-There is small set of custom opinionated defaults. However, to override them in your views just pass an option hash.
+There is small set of custom opinionated defaults. However, to override them in your views just pass an option hash. The following options are valid:
+ :crumb_length # integer, default length is 30 characters
+ :root # boolean, default is true, displays the home crumb
+
== Usage
In controller:
+ class Blog::CategoriesController < ApplicationController
+
+ add_breadcrumb 'Article Categories', 'blog_categories_path', :only => [:show]
+
+ def show
+ add_breadcrumb "#{@category.title}", 'blog_category_path(@category)'
+ end
+ end
+
You can add breadcrumbs for nested resources, for instance, article categories:
You can add semantic markup in your view to show breadcrumbs
<ul id="breadcrumbs">
- <%- breadcrumbs :crumb_length => 5 do |name, url, styles| -%>
- <li class="<%= styles %>"><%= link_to name, url %></li>
+ <%- breadcrumbs :crumb_length => 20 do |name, url, styles| -%>
+ <li class="<%= styles %>">
+ <%= link_to name, url %>
+ <span><%= styles == 'selected' ? '' : '::' %></span>
+ </li>
<%- end -%>
</ul>
== TODO
* Add ability to add breadcrumbs for nested resources
* Add support for name internationalisation
* Finish specs
== Contributing to loaf
-
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
* Fork the project
* Start a feature/bugfix branch
* Commit and push until you are happy with your contribution