Class: UiBibz::Ui::Core::Navigations::Breadcrumb
- 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::::Breadcrumb.new().tap do |b|
b.link content = nil, = nil, = nil, &block
b.link content = nil, = nil, = nil, &block
b.link content = nil, = nil, = nil, &block
...
end
UiBibz::Ui::Core::::Breadcrumb.new(@store)
Examples
UiBibz::Ui::Core::::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::::Breadcrumb.new(@users).render
Helper
do |b|
b.link(content, = {}, = {})
b.link( = {}, = {}) do
content
end
end
# or
@users = User.all
(@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
Instance Method Summary collapse
-
#initialize(content = nil, options = nil, html_options = nil, &block) ⇒ Breadcrumb
constructor
See UiBibz::Ui::Core::Component.initialize.
-
#link(content = nil, options = nil, html_options = nil, &block) ⇒ Object
Add breadcrumb link items See UiBibz::Ui::Core::BreadcrumbLink.
-
#pre_render ⇒ Object
Render html tag.
Methods inherited from Component
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, = nil, = nil, &block) super @links = [] generate_links unless @content.nil? end |
Instance Method Details
#link(content = nil, options = nil, html_options = nil, &block) ⇒ Object
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, = nil, = nil, &block) @links << UiBibz::Ui::Core::::Components::BreadcrumbLink.new(content, , , &block).render end |
#pre_render ⇒ Object
Render html tag
81 82 83 84 85 |
# File 'lib/ui_bibz/ui/core/navigations/breadcrumb.rb', line 81 def pre_render content_tag :nav, do content_tag :ol, @links.join.html_safe, class: 'breadcrumb' end end |