<div class="block">
<nav class="pagination is-centered" role="navigation" aria-label="pagination">
<a class="pagination-previous {% if not offset %}is-disabled{% end %}"
- href="/builds?offset={{ offset - limit }}&limit={{ limit }}{% if user %}&user={{ user.name }}{% end %}">
+ href="{{ make_url("/builds", offset=offset - limit, limit=limit, user=user.name if user else None) }}">
{{ _("Previous Page") }}
</a>
- <a class="pagination-next" href="/builds?offset={{ offset + limit }}&limit={{ limit }}{% if user %}&user={{ user.name }}{% end %}">
+ <a class="pagination-next"
+ href="{{ make_url("/builds", offset=offset + limit, limit=limit, user=user.name if user else None) }}">
{{ _("Next Page") }}
</a>
</nav>
"extract_hostname" : self.extract_hostname,
"format_time" : self.format_time,
"group" : self.group,
+ "make_url" : self.make_url,
},
xsrf_cookies = True,
)
def group(self, handler, *args, **kwargs):
return misc.group(*args, **kwargs)
+
+ def make_url(self, handler, url, **kwargs):
+ # Format any query arguments and append them to the URL
+ if kwargs:
+ args = urllib.parse.urlencode(kwargs)
+
+ url = "%s?%s" % (url, args)
+
+ return url