meilisearch-admin/app/components/pagination.hbs

53 lines
1.4 KiB
Handlebars
Raw Normal View History

2022-03-25 11:23:53 +00:00
{{#if (gt this.totalPages 1)}}
2022-08-20 06:13:53 +00:00
<nav
class='flex justify-center relative z-0'
aria-label='Pagination'
...attributes
>
2022-04-26 10:28:40 +00:00
{{#let
2022-09-19 07:34:18 +00:00
'inline-flex items-center justify-center px-2 mx-1 font-display text-lg text-inherit no-underline'
2022-08-20 06:13:53 +00:00
as |commonClasses|
2022-04-26 10:28:40 +00:00
}}
2022-03-25 11:23:53 +00:00
{{#if this.previousPage}}
<LinkTo
@route={{this.router.currentRouteName}}
2022-10-24 08:09:53 +00:00
@query={{hash offset=(dec @limit @offset)}}
2022-03-25 11:23:53 +00:00
class={{commonClasses}}
2022-08-20 06:13:53 +00:00
title='Previous page'
2022-03-25 11:23:53 +00:00
>
2022-08-27 15:56:39 +00:00
<Icons::ChevronLeft />
2022-03-25 11:23:53 +00:00
</LinkTo>
{{/if}}
{{#each this.availablePages as |i|}}
2022-10-24 08:09:53 +00:00
{{#if (eq this.current i)}}
2022-08-20 06:13:53 +00:00
<span class='{{commonClasses}} border rounded'>
2022-04-26 10:28:40 +00:00
{{i}}
</span>
{{else if (eq '...' i)}}
<span class={{commonClasses}}>
{{i}}
</span>
2022-03-25 11:23:53 +00:00
{{else}}
<LinkTo
@route={{this.router.currentRouteName}}
2022-10-24 08:09:53 +00:00
@query={{hash offset=(mul @limit (dec i))}}
2022-03-25 11:23:53 +00:00
class={{commonClasses}}
>
{{i}}
</LinkTo>
{{/if}}
{{/each}}
{{#if this.nextPage}}
<LinkTo
@route={{this.router.currentRouteName}}
2022-10-24 08:09:53 +00:00
@query={{hash offset=(inc @limit @offset)}}
2022-03-25 11:23:53 +00:00
class={{commonClasses}}
2022-08-20 06:13:53 +00:00
title='Next page'
2022-03-25 11:23:53 +00:00
>
2022-08-27 15:56:39 +00:00
<Icons::ChevronRight />
2022-03-25 11:23:53 +00:00
</LinkTo>
{{/if}}
{{/let}}
</nav>
{{/if}}