Skip to content

Commit

Permalink
Bring in AMP changes that got orphaned in 0.2.7-rc3
Browse files Browse the repository at this point in the history
  • Loading branch information
benhohner committed Mar 23, 2016
1 parent 4593e15 commit b743f7e
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions bootstrap_paginator/templates/bootstrap_paginator/macros.jinja
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

{% macro paginator(page, get_args={}) %}
{% macro paginator(page, get_args={}, amp=False) %}
{% if page.paginator.num_pages > 1 %}
{% set ADJACENT_PAGES = 5 %}

Expand All @@ -22,21 +22,33 @@
{% if start_page > 1 %}
<li><a href="{{ urlencode_plus(get_args, page=1) }}">1</a></span>
{% if start_page > 2 %}
<li class="disabled"><a href="javascript:;">...</a></li>
{% if amp %}
<li class="disabled"><span>...</span></li>
{% else %}
<li class="disabled"><a href="javascript:;">...</a></li>
{% endif %}
{% endif %}
{% endif %}

{% for page_number in range(start_page, end_page) %}
{% if page_number == page.number %}
<li class="active"><a href="javascript:;">{{ page.number }}</a></li>
{% if amp %}
<li class="active"><span>{{ page.number }}</span></li>
{% else %}
<li class="active"><a href="javascript:;">{{ page.number }}</a></li>
{% endif %}
{% else %}
<li><a href="{{ urlencode_plus(get_args, page=page_number) }}">{{ page_number }}</a></li>
{% endif %}
{% endfor %}

{% if end_page < page.paginator.num_pages %}
{% if end_page < page.paginator.num_pages - 1 %}
<li class="disabled"><a href="javascript:;">...</a></li>
{% if amp %}
<li class="disabled"><span>...</span></li>
{% else %}
<li class="disabled"><a href="javascript:;">...</a></li>
{% endif %}
{% endif %}
<li><a href="{{ urlencode_plus(get_args, page=page.paginator.num_pages) }}">
{{ page.paginator.num_pages }}
Expand Down

0 comments on commit b743f7e

Please sign in to comment.