Class: Ui::Breadcrumb::Component::Item
- Inherits:
-
Ui::BaseComponent
- Object
- Ui::BaseComponent
- Ui::Breadcrumb::Component::Item
- Defined in:
- lib/uikit_rails/templates/components/breadcrumb/component.rb
Overview
Individual breadcrumb entry — renders as a link or current-page span.
Instance Attribute Summary collapse
-
#current ⇒ Object
readonly
Returns the value of attribute current.
-
#href ⇒ Object
readonly
Returns the value of attribute href.
-
#html_attrs ⇒ Object
readonly
Returns the value of attribute html_attrs.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(href: nil, current: false, **html_attrs) ⇒ Item
constructor
A new instance of Item.
Constructor Details
#initialize(href: nil, current: false, **html_attrs) ⇒ Item
Returns a new instance of Item.
22 23 24 25 26 27 |
# File 'lib/uikit_rails/templates/components/breadcrumb/component.rb', line 22 def initialize(href: nil, current: false, **html_attrs) @href = href @current = current @html_attrs = html_attrs super() end |
Instance Attribute Details
#current ⇒ Object (readonly)
Returns the value of attribute current.
20 21 22 |
# File 'lib/uikit_rails/templates/components/breadcrumb/component.rb', line 20 def current @current end |
#href ⇒ Object (readonly)
Returns the value of attribute href.
20 21 22 |
# File 'lib/uikit_rails/templates/components/breadcrumb/component.rb', line 20 def href @href end |
#html_attrs ⇒ Object (readonly)
Returns the value of attribute html_attrs.
20 21 22 |
# File 'lib/uikit_rails/templates/components/breadcrumb/component.rb', line 20 def html_attrs @html_attrs end |
Instance Method Details
#call ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/uikit_rails/templates/components/breadcrumb/component.rb', line 29 def call if href && !current content_tag(:a, content, class: "ui-breadcrumb__link", href: href, **html_attrs) else content_tag(:span, content, class: "ui-breadcrumb__current", "aria-current": ("page" if current), **html_attrs) end end |