Module: BootstrapBreadcrumbsHelper
- Defined in:
- app/helpers/bootstrap_breadcrumbs_helper.rb
Overview
RAILS BOOTSTRAP ENGINE
Breadcrumbs twitter.github.com/bootstrap/components.html#breadcrumbs
Copyright 2012-2013 Luiz Eduardo de Oliveira Fonseca, Agência Orangeweb Licensed under The MIT License opensource.org/licenses/MIT
Instance Method Summary collapse
-
#breadcrumb(&block) ⇒ Object
Generates a Breadcrumb Containner.
-
#breadcrumb_active(title) ⇒ Object
Generate a Breadcrumb Active link markup.
-
#breadcrumb_divider(text = "/") ⇒ Object
Generate a breadcrumb divider markup.
-
#breadcrumb_item(title, link, opts = {}) ⇒ Object
Generate a Breadcrumb link markup.
Instance Method Details
#breadcrumb(&block) ⇒ Object
Generates a Breadcrumb Containner
<ul class=“breadcrumb”> <li><a href=“#”>Home</a> <span class=“divider”>/</span></li> <li><a href=“#”>Library</a> <span class=“divider”>/</span></li> <li class=“active”>Data</li> </ul>
28 29 30 |
# File 'app/helpers/bootstrap_breadcrumbs_helper.rb', line 28 def &block content_tag(:ul, capture(&block), :class => "breadcrumb" ) end |
#breadcrumb_active(title) ⇒ Object
Generate a Breadcrumb Active link markup
<li class=“active”>Data</li>
75 76 77 78 |
# File 'app/helpers/bootstrap_breadcrumbs_helper.rb', line 75 def (title) content_for :page_title do title end content_tag :li, title, :class => "active" end |
#breadcrumb_divider(text = "/") ⇒ Object
Generate a breadcrumb divider markup
<span class=“divider”>/</span>
91 92 93 |
# File 'app/helpers/bootstrap_breadcrumbs_helper.rb', line 91 def (text = "/") content_tag(:span, text, :class => "divider") end |
#breadcrumb_item(title, link, opts = {}) ⇒ Object
Generate a Breadcrumb link markup
if not in current page
<li><a href=“#”>Home</a> <span class=“divider”>/</span></li>
if in current page
<li class=“active”>Data</li>
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/helpers/bootstrap_breadcrumbs_helper.rb', line 48 def (title, link, opts={}) recognized = Rails.application.routes.recognize_path(link) if recognized[:controller] == params[:controller] && recognized[:action] == params[:action] content_tag(:li, :class => "active") do (title) end else content_tag(:li) do link_to( title, link, opts) + end end end |