Browse Source

Usa include de paginação na listagem do crud

pull/249/head
Marcio Mazza 9 years ago
parent
commit
9db46013ba
  1. 4
      crud_tests/test_flux.py
  2. 36
      templates/crud/list.html

4
crud_tests/test_flux.py

@ -178,8 +178,8 @@ def assert_on_detail_page(res, stub_name):
@pytest.mark.parametrize("num_entries, page_size, ranges, page_list", [
(0, 6, [], []),
(5, 5, [(0, 5)], []),
(10, 5, [(0, 5), (5, 10)], ['«', '1', '2', '»']),
(9, 4, [(0, 4), (4, 8), (8, 9)], ['«', '1', '2', '3', '»']),
(10, 5, [(0, 5), (5, 10)], ['Anterior', '1', '2', 'Próxima']),
(9, 4, [(0, 4), (4, 8), (8, 9)], ['Anterior', '1', '2', '3', 'Próxima']),
])
def test_flux_list_paginate_detail(
app, monkeypatch, num_entries, page_size, ranges, page_list):

36
templates/crud/list.html

@ -43,40 +43,6 @@
</table>
{% endif %}
{% include "paginacao.html" %}
{% if is_paginated %}
<div class="pagination-centered">
<ul class="pagination" role="menubar" aria-label="Pagination">
{% if page_obj.has_previous %}
<li>
<a href="?page={{ page_obj.previous_page_number }}">
<span class="arrow">&laquo;</span>
</a>
</li>
{% else %}
<li class="arrow unavailable" aria-disabled="true"><a href="">&laquo;</a></li>
{% endif %}
{% for page in page_range %}
{% if page %}
<li {% if page == page_obj.number %}class="current"{% endif %}>
<a href="?page={{ page }}">{{ page }}</a>
</li>
{% else %}
<li class="unavailable" aria-disabled="true"><a href="">&hellip;</a></li>
{% endif %}
{% endfor %}
{% if page_obj.has_next %}
<li>
<a href="?page={{ page_obj.next_page_number }}">
<span class="arrow">&raquo;</span>
</a>
</li>
{% else %}
<li class="arrow unavailable" aria-disabled="true"><a href="">&raquo;</a></li>
{% endif %}
</ul>
</div>
{% endif %}
{% endblock %}

Loading…
Cancel
Save