-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Readme fixes #5
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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| %> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I said above, if you put |
||
<li class="<%= styles %>"> | ||
<%= link_to name, url %> | ||
<span><%= styles == 'selected' ? '' : '::' %></span> | ||
|
@@ -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 | ||
|
@@ -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| %> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as mentioned above. |
||
.. | ||
<% end %> | ||
``` | ||
|
There was a problem hiding this comment.
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.