module Pagy::CalendarExtra::FrontendOverride
def pagy_anchor(pagy, anchor_string: nil)
def pagy_anchor(pagy, anchor_string: nil) return super unless (counts = pagy.vars[:counts]) anchor_string &&= %( #{anchor_string}) left, right = %(<a#{anchor_string} href="#{pagy_url_for(pagy, PAGE_TOKEN)}").split(PAGE_TOKEN, 2) # lambda used by all the helpers lambda do |page, text = pagy.label_for(page), classes: nil, aria_label: nil| count = counts[page - 1] item_name = pagy_t('pagy.item_name', count:) if count.zero? classes = "#{classes && (classes + ' ')}empty-page" title = %( title="#{pagy_t('pagy.info.no_items', item_name:, count:)}") else title = %( title="#{pagy_t('pagy.info.single_page', item_name:, count:)}") end classes = %( class="#{classes}") if classes aria_label = %( aria-label="#{aria_label}") if aria_label %(#{left}#{page}#{right}#{title}#{classes}#{aria_label}>#{text}</a>) end end