Class: NfgUi::Bootstrap::Components::PageItem
- Includes:
- Utilities::Activatable
- Defined in:
- lib/nfg_ui/bootstrap/components/page_item.rb
Overview
Bootstrap Pagination - Page Item Component getbootstrap.com/docs/4.1/components/pagination/
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base
#body, #options, #view_context
Instance Method Summary collapse
- #component_family ⇒ Object
- #disabled ⇒ Object
- #href ⇒ Object
-
#html_options ⇒ Object
Send href through to the “page link” that’s embedded within the page item component.
- #page_link_html_options ⇒ Object
- #render ⇒ Object
Methods included from Utilities::Activatable
Methods inherited from Base
#data, #id, #initialize, #style
Constructor Details
This class inherits a constructor from NfgUi::Bootstrap::Components::Base
Instance Method Details
#component_family ⇒ Object
12 13 14 |
# File 'lib/nfg_ui/bootstrap/components/page_item.rb', line 12 def component_family :pagination end |
#disabled ⇒ Object
16 17 18 |
# File 'lib/nfg_ui/bootstrap/components/page_item.rb', line 16 def disabled .fetch(:disabled, false) end |
#href ⇒ Object
20 21 22 |
# File 'lib/nfg_ui/bootstrap/components/page_item.rb', line 20 def href super || '#' end |
#html_options ⇒ Object
Send href through to the “page link” that’s embedded within the page item component
26 27 28 |
# File 'lib/nfg_ui/bootstrap/components/page_item.rb', line 26 def super.except!(:href) end |
#page_link_html_options ⇒ Object
30 31 32 33 34 |
# File 'lib/nfg_ui/bootstrap/components/page_item.rb', line 30 def { class: 'page-link', **(disabled ? { tabindex: '-1' } : {}), href: href } end |
#render ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/nfg_ui/bootstrap/components/page_item.rb', line 36 def render super do content_tag(:a, ) do capture do concat(block_given? ? yield : body) concat(content_tag(:span, '(current)', class: 'sr-only')) if active end end end end |