# HG changeset patch # User Thomas De Schampheleire # Date 2015-03-03 21:44:27 # Node ID 0f9a48e0adc3a5ec29c7561d9ed3fbb1ec1b5e9e # Parent 42f3115cc2acdc53e682ccca65fac2c977ee4502 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. diff --git a/kallithea/templates/pullrequests/pullrequest_data.html b/kallithea/templates/pullrequests/pullrequest_data.html --- a/kallithea/templates/pullrequests/pullrequest_data.html +++ b/kallithea/templates/pullrequests/pullrequest_data.html @@ -1,5 +1,12 @@ ## -*- coding: utf-8 -*- +<%def name="pullrequest_overview(pullrequests)"> + +%if not len(pullrequests): +
${_('No entries')}
+ <% return %> +%endif +
@@ -12,7 +19,7 @@ -% for pr in c.pullrequests_pager: +% for pr in pullrequests:
${_('To')}
%if pr.last_review_status: @@ -52,8 +59,14 @@
+%if pager in pullrequests:
- ${c.pullrequests_pager.pager('$link_previous ~2~ $link_next', **request.GET.mixed())} + ${pullrequests.pager('$link_previous ~2~ $link_next', **request.GET.mixed())}
+%endif + + + +${pullrequest_overview(c.pullrequests_pager)}