only show the navigation arrow when #contacts > PAGE_LIMIT

This commit is contained in:
Son 2021-10-23 16:08:43 +02:00
parent ff210394a0
commit b0822519eb
2 changed files with 21 additions and 17 deletions

View File

@ -169,6 +169,7 @@
{% endfor %}
</div>
{% if nb_contact > PAGE_LIMIT or page > 0 %}
<div class="row mt-3">
<div class="col">
<nav aria-label="Contact navigation">
@ -187,6 +188,7 @@
</nav>
</div>
</div>
{% endif %}
{% endblock %}

View File

@ -271,6 +271,7 @@ def alias_contact_manager(alias_id):
contact_infos = get_contact_infos(alias, page, query=query)
last_page = len(contact_infos) < PAGE_LIMIT
nb_contact = Contact.filter(Contact.alias_id == alias.id).count()
# if highlighted contact isn't included, fetch it
# make sure highlighted contact is at array start
@ -290,4 +291,5 @@ def alias_contact_manager(alias_id):
page=page,
last_page=last_page,
query=query,
nb_contact=nb_contact,
)