class UiBibz::Ui::Core::Navigations::Breadcrumb

Breadcrumb

Indicate the current page's location within a navigational hierarchy. Separators are automatically added in CSS through :before and content.

This element is an extend of UiBibz::Ui::Core::Component.

Attributes

Options

You can add HTML attributes using the html_options. You can pass arguments in options attribute:

Components

link is UiBibz::Ui::Core::Navigations::BreadCrumb::Components::BreadcrumbLink component

Signatures

UiBibz::Ui::Core::Navigations::Breadcrumb.new().tap do |b|
  b.link content = nil, options = nil, html_options = nil, &block
  b.link content = nil, options = nil, html_options = nil, &block
  b.link content = nil, options = nil, html_options = nil, &block
  ...
end

UiBibz::Ui::Core::Navigations::Breadcrumb.new(@store)

Examples

UiBibz::Ui::Core::Navigations::Breadcrumb.new().tap do |b|
  b.link 'Home', url: '#home'
  b.link url: '#level-1' do
    'Level 1'
  end
  b.link 'Level 2', state: :active
end.render

# or

@users = User.all
UiBibz::Ui::Core::Navigations::Breadcrumb.new(@users).render

Helper

ui_breadcrumb do |b|
  b.link(content, options = {}, html_options = {})
  b.link(options = {}, html_options = {}) do
    content
  end
end

# or

@users = User.all
ui_breadcrumb(@users, { link_label: name, link_url: user_path(:id) })

Public Class Methods

new(content = nil, options = nil, html_options = nil, &block) click to toggle source

See UiBibz::Ui::Core::Component.initialize

Calls superclass method UiBibz::Ui::Core::Component::new
# File lib/ui_bibz/ui/core/navigations/breadcrumb.rb, line 74
def initialize(content = nil, options = nil, html_options = nil, &block)
  super
  @links = []
  generate_links unless @content.nil?
end

Public Instance Methods

pre_render() click to toggle source

Render html tag

# File lib/ui_bibz/ui/core/navigations/breadcrumb.rb, line 81
def pre_render
  content_tag :nav, html_options do
    content_tag :ol, @links.join.html_safe, class: 'breadcrumb'
  end
end

Private Instance Methods

component_html_options() click to toggle source
# File lib/ui_bibz/ui/core/navigations/breadcrumb.rb, line 95
def component_html_options
  super.merge({ 'arial-label': 'breadcrumb' })
end
last_item() click to toggle source
# File lib/ui_bibz/ui/core/navigations/breadcrumb.rb, line 117
def last_item
  content.last
end
model_name() click to toggle source
# File lib/ui_bibz/ui/core/navigations/breadcrumb.rb, line 99
def model_name
  content.class.to_s
end