Module: NdrUi::Bootstrap::BreadcrumbsHelper

Included in:
NdrUi::BootstrapHelper
Defined in:
app/helpers/ndr_ui/bootstrap/breadcrumbs_helper.rb

Overview

This mixin provides Bootstrap breadcrumbs helper methods

Instance Method Summary collapse

Instance Method Details

#bootstrap_breadcrumb(title, linkto, active = false) ⇒ Object

Creates a bootstrap breadcrumb.

Signatures

bootstrap_breadcrumb(title, linkto, active = false)

Examples

<%= bootstrap_breadcrumb("Fruits", "#fruits", true) %>
# => <li class="active"><a href="#fruits">Fruits</a></li>


33
34
35
36
37
# File 'app/helpers/ndr_ui/bootstrap/breadcrumbs_helper.rb', line 33

def bootstrap_breadcrumb(title, linkto, active = false)
  ('li',
              link_to(title, linkto),
              active ? { class: 'active' } : {})
end

#bootstrap_breadcrumbs(breadcrumbs) ⇒ Object

Creates bootstrap breadcrumbs.

Signatures

bootstrap_breadcrumbs(breadcrumbs)

Examples

<%= bootstrap_breadcrumbs([
  bootstrap_breadcrumb("Fruits", "#fruits")
]) %>
# => <ol class="breadcrumb">
       <li class="active"><a href="#fruits">Fruits</a></li>
     </ol>


19
20
21
# File 'app/helpers/ndr_ui/bootstrap/breadcrumbs_helper.rb', line 19

def bootstrap_breadcrumbs(breadcrumbs)
  ('ol', safe_join(breadcrumbs), class: 'breadcrumb')
end