Module: BootstrapNavHelper
- Defined in:
- app/helpers/bootstrap_nav_helper.rb
Overview
RAILS BOOTSTRAP ENGINE
Sidebar & Nav: tabs, pills, and lists twitter.github.com/bootstrap/components.html#navs
Copyright 2012-2013 Luiz Eduardo de Oliveira Fonseca, Agência Orangeweb
Licensed under The MIT License
Instance Method Summary collapse
-
#nav_header(title) ⇒ Object
Separate groups of nav links with a header.
-
#nav_link(title, link, opts = {}) ⇒ Object
Output a Nav Link if not in current page.
-
#nav_list(&block) ⇒ Object
Bootstrap Nav-list.
-
#nav_pills(&block) ⇒ Object
Nav-pills block.
-
#sidebar(&block) ⇒ Object
Sidebar block.
Instance Method Details
#nav_header(title) ⇒ Object
Separate groups of nav links with a header
<li class=“nav-header”>List header</li>
58 59 60 |
# File 'app/helpers/bootstrap_nav_helper.rb', line 58 def nav_header title content_tag(:li, title, :class => "nav-header" ) end |
#nav_link(title, link, opts = {}) ⇒ Object
Output a Nav Link
if not in current page
<li><a href=“#”>Link</a></li>
if in current page
<li class=“active”><a href=“#”>Link</a></li>
74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'app/helpers/bootstrap_nav_helper.rb', line 74 def nav_link(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 link_to( title, link, opts) end else content_tag(:li) do link_to( title, link, opts) end end end |
#nav_list(&block) ⇒ Object
Bootstrap Nav-list
<ul class=“nav nav-list”> … link itens … </ul>
35 36 37 |
# File 'app/helpers/bootstrap_nav_helper.rb', line 35 def nav_list &block content_tag(:ul, capture(&block), :class => "nav nav-list" ) end |
#nav_pills(&block) ⇒ Object
Nav-pills block
<ul class=“nav nav-pills”> … link itens … </ul>
47 48 49 |
# File 'app/helpers/bootstrap_nav_helper.rb', line 47 def nav_pills &block content_tag(:ul, capture(&block), :class => "nav nav-pills" ) end |
#sidebar(&block) ⇒ Object
Sidebar block
23 24 25 |
# File 'app/helpers/bootstrap_nav_helper.rb', line 23 def &block content_tag(:div, capture(&block), :class => "well sidebar-nav" ) end |