Sha256: 0ade03f6f117d249dd60ddb7f613992d17b4c817f027ff89de66c7ea07b31f6a
Contents?: true
Size: 1.48 KB
Versions: 90
Compression:
Stored size: 1.48 KB
Contents
# frozen_string_literal: true module NfgUi module Bootstrap module Components # Bootstrap Pagination - Page Item Component # https://getbootstrap.com/docs/4.1/components/pagination/ class PageItem < NfgUi::Bootstrap::Components::Base # include Bootstrap::Utilities::Disableable include Bootstrap::Utilities::Activatable def component_family :pagination end def disabled options.fetch(:disabled, false) end def href super || '#' end # Send href through to the "page link" that's embedded within # the page item component def html_options super.except!(:href) end def page_link_html_options { class: 'page-link', **(disabled ? { tabindex: '-1' } : {}), href: href } end 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 def base_element :li end def css_classes [ super, ('disabled' if disabled) ].join(' ').squish end def non_html_attribute_options super.push(:disabled) end end end end end
Version data entries
90 entries across 90 versions & 1 rubygems