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] if count.zero? classes = "#{classes && (classes + ' ')}empty-page" info_key = 'pagy.info.no_items' else info_key = 'pagy.info.single_page' end title = %( title="#{pagy_t(info_key, item_name: pagy_t('pagy.item_name', count:), count:)}") 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