Mercurial > kallithea
changeset 4893:0f9a48e0adc3
pullrequest overview: create overview from a function to allow re-use
In anticipation of re-use of the pullrequest overview, create a def to
generate this overview given a list of pullrequests.
This also adds a check if the given list is empty, and a check if there is a
pager before displaying the paging links.
author | Thomas De Schampheleire <thomas.de.schampheleire@gmail.com> |
---|---|
date | Tue, 03 Mar 2015 21:44:27 +0100 |
parents | 42f3115cc2ac |
children | 7eea0a7fbc7d |
files | kallithea/templates/pullrequests/pullrequest_data.html |
diffstat | 1 files changed, 15 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/templates/pullrequests/pullrequest_data.html Tue Mar 03 21:37:44 2015 +0100 +++ b/kallithea/templates/pullrequests/pullrequest_data.html Tue Mar 03 21:44:27 2015 +0100 @@ -1,5 +1,12 @@ ## -*- coding: utf-8 -*- +<%def name="pullrequest_overview(pullrequests)"> + +%if not len(pullrequests): + <div class="normal-indent empty_data">${_('No entries')}</div> + <% return %> +%endif + <div class="table"> <table> <thead> @@ -12,7 +19,7 @@ <th class="left">${_('To')}</th> </tr> </thead> -% for pr in c.pullrequests_pager: +% for pr in pullrequests: <tr class="${'pr-closed' if pr.is_closed() else ''}"> <td> %if pr.last_review_status: @@ -52,8 +59,14 @@ </table> </div> +%if pager in pullrequests: <div class="notification-paginator"> <div class="pagination-wh pagination-left"> - ${c.pullrequests_pager.pager('$link_previous ~2~ $link_next', **request.GET.mixed())} + ${pullrequests.pager('$link_previous ~2~ $link_next', **request.GET.mixed())} </div> </div> +%endif + +</%def> + +${pullrequest_overview(c.pullrequests_pager)}