move pagination into macro
This commit is contained in:
parent
a35d28d22b
commit
7c6a3eb4fa
5 changed files with 9 additions and 40 deletions
|
@ -1,24 +0,0 @@
|
||||||
{% set paginationSeparator %}{% if '%3F' in paginationUrl|default('')|url_encode %}&{% else %}?{% endif %}{% endset %}
|
|
||||||
{% set paginationPage = get.page|default(1) %}
|
|
||||||
|
|
||||||
<div class="pagination{% if paginationClass is defined %} {{ paginationClass }}{% endif %}">
|
|
||||||
{% if paginationPages is defined and paginationPages|length > 1 %}
|
|
||||||
{% if paginationPage > 1 %}
|
|
||||||
{% if paginationPages|length > 2 %}
|
|
||||||
<a class="input__button" href="{{ paginationUrl }}{{ paginationSeparator }}page=1" title="Jump to first page"><span class="fa fa-fast-backward"></span></a>
|
|
||||||
{% endif %}
|
|
||||||
<a class="input__button" href="{{ paginationUrl }}{{ paginationSeparator }}page={{ paginationPage - 1 }}" title="Previous page"><span class="fa fa-step-backward"></span></a>
|
|
||||||
{% endif %}
|
|
||||||
{% for id,page in paginationPages %}
|
|
||||||
{% if (id + 1) > (paginationPage - 3) and (id + 1) < (paginationPage + 3) %}
|
|
||||||
<a class="input__button{% if id == paginationPage - 1 %} input__button--current{% endif %}" href="{{ paginationUrl }}{{ paginationSeparator }}page={{ id + 1 }}" title="Page {{ id + 1 }}">{{ id + 1 }}</a>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
{% if paginationPage < paginationPages|length %}
|
|
||||||
<a class="input__button" href="{{ paginationUrl }}{{ paginationSeparator }}page={{ paginationPage + 1 }}" title="Next page"><span class="fa fa-step-forward"></span></a>
|
|
||||||
{% if paginationPages|length > 2 %}
|
|
||||||
<a class="input__button" href="{{ paginationUrl }}{{ paginationSeparator }}page={{ paginationPages|length }}" title="Jump to last page"><span class="fa fa-fast-forward"></span></a>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
|
@ -1,7 +1,6 @@
|
||||||
{% set friends = profile.friends(2)|batch(12) %}
|
{% from 'macros.twig' import pagination %}
|
||||||
|
|
||||||
{% set paginationPages = friends %}
|
{% set friends = profile.friends(2)|batch(12) %}
|
||||||
{% set paginationUrl %}{{ route('user.profile', profile.id) }}{% endset %}
|
|
||||||
|
|
||||||
<div class="new-profile-mode-title">
|
<div class="new-profile-mode-title">
|
||||||
<h1>Friends</h1>
|
<h1>Friends</h1>
|
||||||
|
@ -23,6 +22,6 @@
|
||||||
</div>
|
</div>
|
||||||
{% if friends|length > 1 %}
|
{% if friends|length > 1 %}
|
||||||
<div style="text-align: right;">
|
<div style="text-align: right;">
|
||||||
{% include 'elements/pagination.twig' %}
|
{{ pagination(route('user.profile', profile.id), friends, get.page|default(1)) }}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
{% extends 'settings/friends/master.twig' %}
|
{% extends 'settings/friends/master.twig' %}
|
||||||
|
{% from 'macros.twig' import pagination %}
|
||||||
|
|
||||||
{% set friends = user.friends(1)|batch(12) %}
|
{% set friends = user.friends(1)|batch(12) %}
|
||||||
|
|
||||||
{% set paginationPages = friends %}
|
|
||||||
{% set paginationUrl %}{{ route('settings.friends.listing') }}{% endset %}
|
|
||||||
|
|
||||||
{% set mode = 'Listing' %}
|
{% set mode = 'Listing' %}
|
||||||
|
|
||||||
{% block description %}
|
{% block description %}
|
||||||
|
@ -29,7 +27,7 @@
|
||||||
</div>
|
</div>
|
||||||
{% if friends|length > 1 %}
|
{% if friends|length > 1 %}
|
||||||
<div>
|
<div>
|
||||||
{% include 'elements/pagination.twig' %}
|
{{ pagination(route('settings.friends.listing'), friends, get.page|default(1)) }}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
{% extends 'settings/friends/master.twig' %}
|
{% extends 'settings/friends/master.twig' %}
|
||||||
|
{% from 'macros.twig' import pagination %}
|
||||||
|
|
||||||
{% set friends = user.friends(-1)|batch(12) %}
|
{% set friends = user.friends(-1)|batch(12) %}
|
||||||
|
|
||||||
{% set paginationPages = friends %}
|
|
||||||
{% set paginationUrl %}{{ route('settings.friends.requests') }}{% endset %}
|
|
||||||
|
|
||||||
{% set mode = 'Requests' %}
|
{% set mode = 'Requests' %}
|
||||||
|
|
||||||
{% block description %}
|
{% block description %}
|
||||||
|
@ -30,7 +28,7 @@
|
||||||
</div>
|
</div>
|
||||||
{% if friends|length > 1 %}
|
{% if friends|length > 1 %}
|
||||||
<div>
|
<div>
|
||||||
{% include 'elements/pagination.twig' %}
|
{{ pagination(route('settings.friends.requests'), friends, get.page|default(1)) }}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{% extends 'master.twig' %}
|
{% extends 'master.twig' %}
|
||||||
|
{% from 'macros.twig' import pagination %}
|
||||||
|
|
||||||
{% set sorts = ['boxes', 'rectangles', 'list'] %}
|
{% set sorts = ['boxes', 'rectangles', 'list'] %}
|
||||||
{% set sort = get is defined and get.sort is defined and get.sort in sorts ? get.sort : sorts[0] %}
|
{% set sort = get is defined and get.sort is defined and get.sort in sorts ? get.sort : sorts[0] %}
|
||||||
|
@ -11,9 +12,6 @@
|
||||||
|
|
||||||
{% set currPage = get.page|default(1) - 1 %}
|
{% set currPage = get.page|default(1) - 1 %}
|
||||||
|
|
||||||
{% set paginationPages = users %}
|
|
||||||
{% set paginationUrl %}{% if rank %}{{ route('members.rank', rank) }}{% else %}{{ route('members.index') }}{% endif %}{% endset %}
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="announce-box" style="margin-bottom: 1px;">
|
<div class="announce-box" style="margin-bottom: 1px;">
|
||||||
<h1 style="{% if rank %}text-shadow: 0 0 5px {{ ranks[rank].colour }}; color: {{ ranks[rank].colour }};{% else %}text-shadow: 0 0 5px #555;{% endif %}">{{ title }}</h1>
|
<h1 style="{% if rank %}text-shadow: 0 0 5px {{ ranks[rank].colour }}; color: {{ ranks[rank].colour }};{% else %}text-shadow: 0 0 5px #555;{% endif %}">{{ title }}</h1>
|
||||||
|
@ -95,7 +93,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% if users|length > 1 %}
|
{% if users|length > 1 %}
|
||||||
{% include 'elements/pagination.twig' %}
|
{{ pagination(rank ? route('members.rank', rank) : route('members.index'), users, get.page|default(1)) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
Reference in a new issue