[PATCH 3 of 6] pullrequest overview: create overview from a function to allow re-use
Thomas De Schampheleire
patrickdepinguin at gmail.com
Tue Mar 3 16:40:30 EST 2015
# HG changeset patch
# User Thomas De Schampheleire <thomas.de.schampheleire at gmail.com>
# Date 1425415467 -3600
# Tue Mar 03 21:44:27 2015 +0100
# Node ID acea7f4e8c6bfefb8526ebe5b1b1ad7914c7ee5d
# Parent a076460a649e0e6fd03a530512fbcd838fe52ee5
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):
+ <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)}
More information about the kallithea-general
mailing list