Skip to content

Commit

Permalink
Merge 2f045b7 into dbb8659
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Kapkov committed Jan 16, 2015
2 parents dbb8659 + 2f045b7 commit 3fba975
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Expand Up @@ -55,22 +55,22 @@ class Blog::CategoriesController < ApplicationController
breadcrumb 'Article Categories', :blog_categories_path, only: [:show]

def show
breadcrumb "#{@category.title}", blog_category_path(@category)
breadcrumb @category.title, blog_category_path(@category)
end
end
```

**Loaf** adds `breadcrumb` helper also to the views. Together with controller breadcrumbs, the view breadcrumbs are appended as the last. For instance, to specify view breadcrumb do:

```ruby
<% breadcrumb "#{@category.title}", blog_category_path(@category) %>
<%= breadcrumb @category.title, blog_category_path(@category) %>
```
Finally, in your view layout add semantic markup to show breadcrumbs:
```html
<ul class='breadcrumbs'>
<% breadcrumbs do |name, url, styles| %>
<%= breadcrumbs do |name, url, styles| %>
<li class="<%= styles %>">
<%= link_to name, url %>
<span><%= styles == 'selected' ? '' : '::' %></span>
Expand All @@ -94,19 +94,19 @@ breadcrumb 'Categories', blog_categories_path
When using an instance `@category`:
```ruby
braedcrumb "#{@category.title}", blog_category_path(@category)
braedcrumb @category.title, blog_category_path(@category)
```
You can also use set of objects:
```ruby
breadcrumb "#{@category.title}, [:blog, @category]"
breadcrumb @category.title, [:blog, @category]
```
You can specify segments of the url:
```ruby
breadcrumb "#{@category.title}", {controller: 'categories', action: 'show', id: @category.id}
breadcrumb @category.title, {controller: 'categories', action: 'show', id: @category.id}
```
## 2. Configuration
Expand All @@ -124,7 +124,7 @@ There is a small set of custom opinionated defaults. The following options are v
You can override them in your views by passing them to the view `breadcrumb` helper
```ruby
<% breadcrumbs crumb_length: 20 do |name, url, styles| %>
<%= breadcrumbs crumb_length: 20 do |name, url, styles| %>
..
<% end %>
```
Expand Down

0 comments on commit 3fba975

Please sign in to comment.