-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add some grid paginator twig templates
- Loading branch information
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{% apply spaceless %} | ||
{% set pager = grid.page %} | ||
{% set input = grid.input %} | ||
{% set window = window|default(4) %} | ||
<ul class="ui-grid-pager-full"> | ||
{% if pager.currentPage == 1 %} | ||
<li class="disabled"><span><</span></li> | ||
{% else %} | ||
<li><a href="{{ input.applyPage(pager.currentPage - 1) }}"><</a></li> | ||
{% endif %} | ||
|
||
{% for i in 1..pager.pageCount %} | ||
{% if loop.index == 1 and pager.currentPage != loop.index %} | ||
<li> | ||
<a href="{{ input.applyPage(loop.index) }}">{{ loop.index }}</a> | ||
</li> | ||
{% elseif loop.index == pager.pageCount and pager.currentPage != loop.index %} | ||
<li> | ||
<a href="{{ input.applyPage(loop.index) }}">{{ loop.index }}</a> | ||
</li> | ||
{% elseif 0 == (pager.currentPage - window) - loop.index %} {# dots before #} | ||
<li class="disabled"><span>...</span></li> | ||
{% elseif 0 == (pager.currentPage + window) - loop.index %} {# dots after #} | ||
<li class="disabled"><span>...</span></li> | ||
{% elseif 0 < (pager.currentPage - window) - loop.index %} {# hide all before #} | ||
{% elseif 0 > (pager.currentPage + window) - loop.index %} {# hide all after #} | ||
{% elseif pager.currentPage == loop.index %} | ||
<li class="active"> | ||
<span>{{ loop.index }}</span> | ||
</li> | ||
{% else %} | ||
<li> | ||
<a href="{{ input.applyPage(loop.index) }}">{{ loop.index }}</a> | ||
</li> | ||
{% endif %} | ||
{% endfor %} | ||
|
||
{% if pager.currentPage < pager.pageCount %} | ||
<li><a href="{{ input.applyPage(pager.currentPage + 1) }}">></a></li> | ||
{% else %} | ||
<li class="disabled"><span>></span></li> | ||
{% endif %} | ||
</ul> | ||
{% endapply %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<ul class="ui-grid-pager-simple"> | ||
<li{{ 1 == grid.page.currentPage ? ' class="disabled"' }}><a href="{{ grid.input.applyPage(1) }}">First</a></li> | ||
<li{{ not grid.page.previousPage ? ' class="disabled"' }}><a href="{{ grid.input.applyPage(grid.page.previousPage|default(1)) }}">Previous</a></li> | ||
<li{{ not grid.page.nextPage ? ' class="disabled"' }}><a href="{{ grid.input.applyPage(grid.page.nextPage|default(grid.page.lastPage)) }}">Next</a></li> | ||
<li{{ grid.page.lastPage == grid.page.currentPage ? ' class="disabled"' }}><a href="{{ grid.input.applyPage(grid.page.lastPage) }}">Last</a></li> | ||
</ul> |