Files
Kent Riboe 00622a1155 Add reusable _pagination.tpl partial, use it in viewlog (#1064) (#1090)
adds templates/_pagination.tpl - bootstrap 5 shared pagination component. 
migrates viewlog to use it.

See  #1064 (thanks @TrapoSAMA and @Knofte)
2026-07-27 19:14:24 +01:00

30 lines
1.5 KiB
Smarty

{*
* Reusable Bootstrap 5 pagination.
*
* $pagination - array of items; each item is an array with keys:
* label - text/entity to display
* url - href (used unless disabled/active/ellipsis)
* active - bool, marks the current page
* disabled - bool, rendered as a non-clickable span
* ellipsis - bool, rendered as a "..." gap
* aria - optional aria-label (for nav arrows)
* $pagination_label - optional aria-label for the <nav> (defaults to "Pagination")
*}
{if $pagination}
<nav aria-label="{$pagination_label|default:'Pagination'}">
<ul class="pagination justify-content-end mb-0">
{foreach from=$pagination item=pi}
{if $pi.ellipsis|default:false}
<li class="page-item disabled"><span class="page-link" aria-hidden="true">&hellip;</span></li>
{elseif $pi.disabled|default:false}
<li class="page-item disabled"><span class="page-link" aria-hidden="true">{$pi.label}</span></li>
{elseif $pi.active|default:false}
<li class="page-item active"><span class="page-link" aria-current="page">{$pi.label}</span></li>
{else}
<li class="page-item"><a class="page-link" href="{$pi.url}"{if $pi.aria|default:''} aria-label="{$pi.aria}"{/if}>{$pi.label}</a></li>
{/if}
{/foreach}
</ul>
</nav>
{/if}