class NfgUi::Bootstrap::Components::PageItem
Bootstrap
Pagination
- Page Item Component getbootstrap.com/docs/4.1/components/pagination/
Public Instance Methods
component_family()
click to toggle source
# File lib/nfg_ui/bootstrap/components/page_item.rb, line 12 def component_family :pagination end
disabled()
click to toggle source
# File lib/nfg_ui/bootstrap/components/page_item.rb, line 16 def disabled options.fetch(:disabled, false) end
href()
click to toggle source
Calls superclass method
NfgUi::Bootstrap::Components::Base#href
# File lib/nfg_ui/bootstrap/components/page_item.rb, line 20 def href super || '#' end
html_options()
click to toggle source
Send href through to the “page link” that's embedded within the page item component
Calls superclass method
NfgUi::Bootstrap::Components::Base#html_options
# File lib/nfg_ui/bootstrap/components/page_item.rb, line 26 def html_options super.except!(:href) end
page_link_html_options()
click to toggle source
# File lib/nfg_ui/bootstrap/components/page_item.rb, line 30 def page_link_html_options { class: 'page-link', **(disabled ? { tabindex: '-1' } : {}), href: href } end
render() { |: body)| ... }
click to toggle source
Calls superclass method
NfgUi::Bootstrap::Components::Base#render
# File lib/nfg_ui/bootstrap/components/page_item.rb, line 36 def render super do content_tag(:a, page_link_html_options) do capture do concat(block_given? ? yield : body) concat(content_tag(:span, '(current)', class: 'sr-only')) if active end end end end
Private Instance Methods
base_element()
click to toggle source
# File lib/nfg_ui/bootstrap/components/page_item.rb, line 49 def base_element :li end
css_classes()
click to toggle source
Calls superclass method
NfgUi::Bootstrap::Utilities::Activatable#css_classes
# File lib/nfg_ui/bootstrap/components/page_item.rb, line 53 def css_classes [ super, ('disabled' if disabled) ].join(' ').squish end
non_html_attribute_options()
click to toggle source
Calls superclass method
NfgUi::Bootstrap::Utilities::Activatable#non_html_attribute_options
# File lib/nfg_ui/bootstrap/components/page_item.rb, line 60 def non_html_attribute_options super.push(:disabled) end