Skip to content

Commit

Permalink
noself attribute to breadcrumbs tag
Browse files Browse the repository at this point in the history
  • Loading branch information
will-r committed Sep 21, 2010
1 parent 58d1dba commit a978402
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/models/standard_tags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -808,16 +808,19 @@ class TagError < StandardError; end
Renders a trail of breadcrumbs to the current page. The separator attribute
specifies the HTML fragment that is inserted between each of the breadcrumbs. By
default it is set to @>@. The boolean nolinks attribute can be specified to render
breadcrumbs in plain text, without any links (useful when generating title tag).
breadcrumbs in plain text, without any links (useful when generating title tag).
Set the noself attribute to 'true' to omit the present page (useful in page headers).

*Usage:*

<pre><code><r:breadcrumbs [separator="separator_string"] [nolinks="true"] /></code></pre>
<pre><code><r:breadcrumbs [separator="separator_string"] [nolinks="true"] [noself="true"]/></code></pre>
}
tag 'breadcrumbs' do |tag|
page = tag.locals.page
breadcrumbs = [page.breadcrumb]
nolinks = (tag.attr['nolinks'] == 'true')
noself = (tag.attr['noself'] == 'true')
breadcrumbs = []
breadcrumbs << (noself) ? '' : page.breadcrumb
page.ancestors.each do |ancestor|
tag.locals.page = ancestor
if nolinks
Expand Down

0 comments on commit a978402

Please sign in to comment.