module Pagy::Frontend
def pagy_semantic_compact_nav(pagy, id=pagy_id)
Compact pagination for semantic: it returns the html with the series of links to the pages
def pagy_semantic_compact_nav(pagy, id=pagy_id) html, link, p_prev, p_next, p_page, p_pages = +'', pagy_link_proc(pagy, 'class="item"'), pagy.prev, pagy.next, pagy.page, pagy.pages html << %(<div id="#{id}" class="pagy-nav-compact-semantic pagy-semantic-compact-nav ui compact menu" role="navigation" aria-label="pager">) html << link.call(MARKER, '', %(style="display: none;" )) (html << link.call(1, '', %(style="display: none;" ))) if defined?(TRIM) html << (p_prev ? %(#{link.call p_prev, '<i class="left small chevron icon"></i>', 'aria-label="previous"'}) : %(<div class="item disabled"><i class="left small chevron icon"></i></div>)) input = %(<input type="number" min="1" max="#{p_pages}" value="#{p_page}" style="padding: 0; text-align: center; width: #{p_pages.to_s.length+1}rem; margin: 0 0.3rem">) html << %(<div class="pagy-compact-input item">#{pagy_t('pagy.compact', page_input: input, count: p_page, pages: p_pages)}</div> ) html << (p_next ? %(#{link.call p_next, '<i class="right small chevron icon"></i>', 'aria-label="next"'}) : %(<div class="item disabled"><i class="right small chevron icon"></i></div>)) html << %(</div>#{pagy_json_tag(:compact, id, MARKER, p_page, !!defined?(TRIM))}) end