Class: Occams::Content::Tags::Breadcrumbs
- Inherits:
-
Occams::Content::Tag
- Object
- Occams::Content::Tag
- Occams::Content::Tags::Breadcrumbs
- Defined in:
- lib/occams/content/tags/breadcrumbs.rb
Overview
Nav Tag for rendering breadcrumb links to current page
{{ cms: }}
{{ cms: style: "font-weight: bold" }}
To customize your breadcrumbs style, add a ‘breadcrumbs’ id to your CSS, e.g #breadcrumbs
color: #006633;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 105%;
font-weight: bold;
margin-top: 12px;
margin-bottom: 4px;
font-style: italic;
and/or pass in style overrides with the ‘style’ parameter, as above
Instance Attribute Summary collapse
-
#links ⇒ Object
readonly
Returns the value of attribute links.
-
#locals ⇒ Object
readonly
Returns the value of attribute locals.
-
#style ⇒ Object
readonly
Returns the value of attribute style.
Attributes inherited from Occams::Content::Tag
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(context:, params: [], source: nil) ⇒ Breadcrumbs
constructor
A new instance of Breadcrumbs.
Methods inherited from Occams::Content::Tag
Constructor Details
#initialize(context:, params: [], source: nil) ⇒ Breadcrumbs
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/occams/content/tags/breadcrumbs.rb', line 21 def initialize(context:, params: [], source: nil) super @locals = params. @style = '' @style = "<style>#breadcrumbs {#{@locals['style']}}</style>" if @locals['style'] @links = '<div id="breadcrumbs">' context.ancestors.reverse.each do |a| next if Rails.env == 'production' && !a.is_published @links += "<a href=#{a.url(relative: true)}>#{a.label}</a> » " end @links += "#{context.label}</div>" end |
Instance Attribute Details
#links ⇒ Object (readonly)
Returns the value of attribute links.
19 20 21 |
# File 'lib/occams/content/tags/breadcrumbs.rb', line 19 def links @links end |
#locals ⇒ Object (readonly)
Returns the value of attribute locals.
19 20 21 |
# File 'lib/occams/content/tags/breadcrumbs.rb', line 19 def locals @locals end |
#style ⇒ Object (readonly)
Returns the value of attribute style.
19 20 21 |
# File 'lib/occams/content/tags/breadcrumbs.rb', line 19 def style @style end |
Instance Method Details
#content ⇒ Object
36 37 38 |
# File 'lib/occams/content/tags/breadcrumbs.rb', line 36 def content format("#{@style}#{@links}") end |