class UiBibz::Ui::Core::Navigations::NavLinkLink

Create a NavLinkLink

This element is an extend of UiBibz::Ui::Core::Component.

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

Public Instance Methods

pre_render() click to toggle source

Render html tag

# File lib/ui_bibz/ui/core/navigations/components/nav_link_link.rb, line 25
def pre_render
  content_tag :a, { href: options[:url] }.merge(html_options) do
    concat glyph_and_content_html
    concat tag_html if options[:tag]
  end
end

Private Instance Methods

component_html_classes() click to toggle source
# File lib/ui_bibz/ui/core/navigations/components/nav_link_link.rb, line 34
def component_html_classes
  if options[:nav_type] == 'list-group'
    'list-group-item list-group-item-action'
  else
    'nav-link'
  end
end
component_html_options() click to toggle source
# File lib/ui_bibz/ui/core/navigations/components/nav_link_link.rb, line 42
def component_html_options
  html_tag_base = { 'data-bs-toggle' => 'tab', role: 'tab' }
  case options[:nav_type]
  when 'nav-tabs'
    html_tag_base
  when 'list-group'
    html_tag_base.merge('aria-controls': sanitize_text(content).parameterize)
  else
    {}
  end.merge(options[:a_html] || {})
end