Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readme fixes #5

Merged
merged 1 commit into from Jan 19, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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) %>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, I don't think it's correct to use =, because we are adding a new breadcrumb to the list not printing them.

```

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| %>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I said above, if you put = here at the end of the command it'll print something like this:
[#<Loaf::Crumb:0x007faa491f9f00 ..

<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| %>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as mentioned above.

..
<% end %>
```
Expand Down