lib/pagy/extras/materialize.rb in pagy-5.10.1 vs lib/pagy/extras/materialize.rb in pagy-6.0.0

- old
+ new

@@ -10,11 +10,11 @@ # Pagination for materialize: it returns the html with the series of links to the pages def pagy_materialize_nav(pagy, pagy_id: nil, link_extra: '', **vars) p_id = %( id="#{pagy_id}") if pagy_id link = pagy_link_proc(pagy, link_extra: link_extra) - html = +%(<div#{p_id} class="pagy-materialize-nav pagination" role="navigation" aria-label="pager"><ul class="pagination">) + html = +%(<div#{p_id} class="pagy-materialize-nav pagination" role="navigation"><ul class="pagination">) html << pagy_materialize_prev_html(pagy, link) pagy.series(**vars).each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36] html << case item when Integer then %(<li class="waves-effect">#{link.call item}</li>) # page link when String then %(<li class="active">#{link.call item}</li>) # active page @@ -36,11 +36,11 @@ 'link' => %(<li class="waves-effect">#{mark = link.call(PAGE_PLACEHOLDER, LABEL_PLACEHOLDER)}</li>), 'active' => %(<li class="active">#{mark}</li>), 'gap' => %(<li class="gap disabled"><a href="#">#{pagy_t 'pagy.nav.gap'}</a></li>), 'after' => %(#{pagy_materialize_next_html pagy, link}</ul>) } - %(<div#{p_id} class="#{'pagy-rjs ' if sequels.size > 1}pagy-materialize-nav-js" role="navigation" aria-label="pager" #{ + %(<div#{p_id} class="#{'pagy-rjs ' if sequels.size > 1}pagy-materialize-nav-js" role="navigation" #{ pagy_data(pagy, :nav, tags, sequels, pagy.label_sequels(sequels))}></div>) end # Javascript combo pagination for materialize: it returns a nav and a JSON tag used by the pagy.js file def pagy_materialize_combo_nav_js(pagy, pagy_id: nil, link_extra: '') @@ -51,10 +51,10 @@ style = ' style="vertical-align: middle"' input = %(<input type="number" class="browser-default" min="1" max="#{p_pages}" value="#{ p_page}" style="text-align: center; width: #{p_pages.to_s.length + 1}rem;">) html = %(<ul#{p_id} class="pagy-materialize-combo-nav-js pagination chip" role="navigation") - %(#{html} aria-label="pager" style="padding-right: 0" #{ + %(#{html} style="padding-right: 0" #{ pagy_data(pagy, :combo, pagy_marked_link(link))}>#{ pagy_materialize_prev_html pagy, link, style}<li class="pagy-combo-input">#{ pagy_t 'pagy.combo_nav_js', page_input: input, count: p_page, pages: p_pages}</li>#{ pagy_materialize_next_html pagy, link, style}</ul>) end