Skip to content

Commit

Permalink
Merge pull request #4 from tigron/3.x
Browse files Browse the repository at this point in the history
Implemented disabled previous and next for Bootstrap 3 and 4
  • Loading branch information
LionelLaffineur authored Jun 19, 2023
2 parents c5c48df + b4db0e9 commit d896f16
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
13 changes: 12 additions & 1 deletion template/bootstrap3/links.twig
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
<ul class="pagination pagination-centered" id="pager-{{ classname|replace({'_': '-'}) }}">
{% for link in links %}
<li class="{% if link.active %}active{% endif %}">
{% set disabled = false %}

<!-- if previous link and first page is active -->
{% if link.page == 'previous' and links.1.active %}
{% set disabled = true %}
{% endif %}

<!-- if next link and last page is active -->
{% if link.page == 'next' and links[(links|length) - 2].active %}
{% set disabled = true %}
{% endif %}
<li class="{% if link.active %}active{% endif %}{% if disabled %} disabled{% endif %}">
<a href="{{ link.url }}" class="skeleton-pager-link">
{% if link.page == 'previous' %}
&laquo;
Expand Down
13 changes: 12 additions & 1 deletion template/bootstrap4/links.twig
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
<ul class="pagination" id="pager-{{ classname|replace({'_': '-'}) }}">
{% for link in links %}
<li class="page-item {% if link.active %}active{% endif %}">
{% set disabled = false %}

<!-- if previous link and first page is active -->
{% if link.page == 'previous' and links.1.active %}
{% set disabled = true %}
{% endif %}

<!-- if next link and last page is active -->
{% if link.page == 'next' and links[(links|length) - 2].active %}
{% set disabled = true %}
{% endif %}
<li class="page-item {% if link.active %}active{% endif %}{% if disabled %} disabled{% endif %}">
<a href="{{ link.url }}" class="skeleton-pager-link page-link">
{% if link.page == 'previous' %}
&laquo;
Expand Down

0 comments on commit d896f16

Please sign in to comment.