paginationCombo.ftl

 1   <#-- Macro: paginationCombo
 2   
 3   Description: Generates a combo box for selecting the number of items per page in a pagination bar.
 4   
 5   Parameters:
 6   - paginator (object): an object that contains information about the current and next/previous pages in a list.
 7   - nb_items_per_page (number, optional): the number of items to display per page (default is the value of the "nb_items_per_page" variable).
 8   - showall (boolean, optional): whether to display an option to show all items on a single page (default is 0).
 9   -->
 10   <#macro paginationCombo paginator nb_items_per_page=nb_items_per_page showall=0>
 11   
 12   <nav aria-label="Page navigation example">
 13     <ul class="pagination justify-content-end">
 14         <li class="page-item border-end-0" style="">
 15         <a class="page-link text-dark border-end-0">${paginator.labelItemCountPerPage}</a>
 16       </li>
 17       <li class="page-item"><@select params='data-max-item="${paginator.itemsCount}"' size='sm' name='${paginator.itemsPerPageParameterName}' class="rounded-0" id='${paginator.itemsPerPageParameterName}' title='${paginator.labelItemCountPerPage}'>
 18     		<#list [ "10" , "20" , "50" , "100" ] as nb>
 19     			<#if nb_items_per_page = nb >
 20     				<option selected="selected" value="${nb}">${nb}</option>
 21     			<#else>
 22     				<option value="${nb}">${nb}</option>
 23     			</#if>
 24     		</#list>
 25     		<#if showall ==1>
 26     			<#if paginator.itemsCount &gt; 100 >
 27     				<option <#if nb_items_per_page?number = paginator.itemsCount?number >selected="selected"</#if> value="${paginator.itemsCount}" class="${nb_items_per_page}">#i18n{portal.util.labelAll}</option>
 28     			</#if>
 29     		</#if>
 30   	</@select></li>
 31       <li class="page-item">
 32   		<@button type='submit' class="page-link" color='oultine' size='xs' title='#i18n{portal.util.labelRefresh}' buttonIcon='check' hideTitle=['all'] />
 33       </li>
 34     </ul>
 35   </nav>
 36   </#macro>