class UiBibz::Ui::Core::Navigations::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) })
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
link(content = nil, options = nil, html_options = nil, &block)
click to toggle source
Add breadcrumb link items See UiBibz::Ui::Core::BreadcrumbLink
# 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_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
Calls superclass method
UiBibz::Ui::Core::Component#component_html_options
# File lib/ui_bibz/ui/core/navigations/breadcrumb.rb, line 95 def component_html_options super.merge({ 'arial-label': 'breadcrumb' }) end
generate_links()
click to toggle source
# File lib/ui_bibz/ui/core/navigations/breadcrumb.rb, line 111 def generate_links content.each do |item| @links << UiBibz::Ui::Core::Navigations::Components::BreadcrumbLink.new(item.send(link_label), url: inject_url(link_url, item), current: item == last_item).render end end
last_item()
click to toggle source
# File lib/ui_bibz/ui/core/navigations/breadcrumb.rb, line 117 def last_item content.last end
link_label()
click to toggle source
# File lib/ui_bibz/ui/core/navigations/breadcrumb.rb, line 103 def link_label @options[:link_label] || :name end
link_url()
click to toggle source
# File lib/ui_bibz/ui/core/navigations/breadcrumb.rb, line 107 def link_url @options[:link_url] || '#' 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