lib/pagy/extras/semantic.rb in pagy-7.0.5 vs lib/pagy/extras/semantic.rb in pagy-7.0.6
- old
+ new
@@ -19,11 +19,11 @@
pagy.series(**vars).each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
html << case item
when Integer
link.call(item, pagy.label_for(item), %(class="item"))
when String
- link.call(item, pagy.label_for(item), %(class="item active"))
+ %(<a role="link" class="item active" aria-current="page" aria-disabled="true">#{pagy.label_for(item)}</a>)
when :gap
%(<div class="disabled item">#{pagy_t 'pagy.gap'}</div>)
else
raise InternalError, "expected item types in series to be Integer, String or :gap; got #{item.inspect}"
end
@@ -37,11 +37,11 @@
nav_aria_label: nil, nav_i18n_key: nil, **vars)
sequels = pagy.sequels(**vars)
p_id = %( id="#{pagy_id}") if pagy_id
link = pagy_link_proc(pagy, link_extra:)
tags = { 'before' => semantic_prev_html(pagy, link),
- 'link' => link.call(PAGE_PLACEHOLDER, LABEL_PLACEHOLDER, %(class="item")),
- 'active' => link.call(PAGE_PLACEHOLDER, LABEL_PLACEHOLDER, %(class="item active")),
+ 'link' => link.call(PAGE_TOKEN, LABEL_TOKEN, %(class="item")),
+ 'active' => %(<a role="link" class="item active" aria-current="page" aria-disabled="true">#{LABEL_TOKEN}</a>),
'gap' => %(<div class="disabled item">#{pagy_t('pagy.gap')}</div>),
'after' => semantic_next_html(pagy, link) }
%(<div#{p_id} class="#{'pagy-rjs ' if sequels.size > 1}pagy-semantic-nav-js ui pagination menu" role="navigation" #{
nav_aria_label_attr(pagy, nav_aria_label, nav_i18n_key)} #{