Class: UiBibz::Ui::Core::Navigations::NavLink
- Includes:
- UiBibz::Ui::Concerns::HtmlConcern
- Defined in:
- lib/ui_bibz/ui/core/navigations/components/nav_link.rb
Overview
Create a NavLink
This element is an extend of UiBibz::Ui::Core::Navigations::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:
-
state- status of element with symbol value: (:active) -
url- String -
badge- String -
link_html_options- Hash
Signatures
UiBibz::Ui::Core::Navigations::NavLink.new(content, = nil, = nil)
UiBibz::Ui::Core::Navigations::NavLink.new( = nil, = nil) do
content
end
Examples
UiBibz::Ui::Core::Navigations::NavLink.new(content, { badge: 15, url: '/', state: :active, link_html_options: { class: 'link1' }},{ class: 'test' }).render
UiBibz::Ui::Core::Navigations::NavLink.new({glyph: { name: 'eye', size: 3 }, { class: 'test' }) do
'Home'
end.render
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) ⇒ NavLink
constructor
See UiBibz::Ui::Core::Component.initialize.
-
#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) ⇒ NavLink
See UiBibz::Ui::Core::Component.initialize
47 48 49 50 |
# File 'lib/ui_bibz/ui/core/navigations/components/nav_link.rb', line 47 def initialize(content = nil, = nil, = nil, &block) super @old_options = end |
Instance Method Details
#pre_render ⇒ Object
Render html tag
53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/ui_bibz/ui/core/navigations/components/nav_link.rb', line 53 def pre_render if [:nav_tags] == :a || %w[nav-links list-group].include?([:nav_type]) UiBibz::Ui::Core::Navigations::NavLinkLink.new(content, , ).render else cont = if [:tag_type] == :span UiBibz::Ui::Core::Navigations::NavLinkSpan.new(content, @old_options).render else UiBibz::Ui::Core::Navigations::NavLinkLink.new(content, ).render end # html_options[:class] = remove_class(html_options[:class]) remove_classes UiBibz::Ui::Core::Navigations::NavLinkList.new(cont, , ).render end end |