Class: UiBibz::Ui::Core::Navigations::Breadcrumb

Inherits:
Component
  • Object
show all
Includes:
UiBibz::Ui::Concerns::HtmlConcern
Defined in:
lib/ui_bibz/ui/core/navigations/breadcrumb.rb

Overview

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

  • content - Content of element

  • options - Options of element

  • html_options - Html Options of element

Options

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

  • link_label - [Symbol | String] Display label of link with store

  • link_url - [String] Display url of link with store

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) })

Constant Summary

Constants inherited from Component

Component::BREAKPOINTS, Component::SIZES, Component::STATUSES

Instance Attribute Summary

Attributes inherited from Component

#content, #html_options, #options

Attributes inherited from Base

#output_buffer

Instance Method Summary collapse

Methods inherited from Component

#render, #tapped?

Methods included from PopoverExtension

#popover_data_html, #tooltip_data_html

Methods included from GlyphExtension

#generate_glyph, #glyph_and_content_html

Methods included from KlassExtension

#exclude_classes, #exclude_classes_in_html_options, #join_classes, #status

Methods inherited from Base

#generate_id, #i18n_set?, #inject_url

Constructor Details

#initialize(content = nil, options = nil, html_options = nil, &block) ⇒ Breadcrumb

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



74
75
76
77
78
# 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

Instance Method Details

Add breadcrumb link items See UiBibz::Ui::Core::BreadcrumbLink



89
90
91
# File 'lib/ui_bibz/ui/core/navigations/breadcrumb.rb', line 89

def link(content = nil, options = nil, html_options = nil, &block)
  @links << UiBibz::Ui::Core::Navigations::Components::BreadcrumbLink.new(content, options, html_options, &block).render
end

#pre_renderObject

Render html tag



81
82
83
84
85
# File 'lib/ui_bibz/ui/core/navigations/breadcrumb.rb', line 81

def pre_render
   :nav, html_options do
     :ol, @links.join.html_safe, class: 'breadcrumb'
  end
end