# HG changeset patch # User Daniele Nicolodi # Date 1320348646 -3600 # Node ID 498ed3c29a0a0a7c2eb6e4fcdd962036cdf8658f # Parent 2429e9db4f34c0cf9761e44015c707ff9d38e802 Allow user to alter pagination size in object listings. diff -r 2429e9db4f34 -r 498ed3c29a0a src/ltpdarepo/__init__.py --- a/src/ltpdarepo/__init__.py Wed Oct 26 20:13:12 2011 +0200 +++ b/src/ltpdarepo/__init__.py Thu Nov 03 20:30:46 2011 +0100 @@ -98,6 +98,14 @@ app.jinja_env.globals['url_for_other_order'] = url_for_other_order +def url_for_other_size(size): + args = request.view_args.copy() + args.update(request.args) + args.update(n=size) + return url_for(request.endpoint, **args) +app.jinja_env.globals['url_for_other_size'] = url_for_other_size + + def is_safe_url(target): ref = urlparse(request.host_url) test = urlparse(urljoin(request.host_url, target)) diff -r 2429e9db4f34 -r 498ed3c29a0a src/ltpdarepo/static/style.css --- a/src/ltpdarepo/static/style.css Wed Oct 26 20:13:12 2011 +0200 +++ b/src/ltpdarepo/static/style.css Thu Nov 03 20:30:46 2011 +0100 @@ -327,12 +327,32 @@ /* pagination */ -.pagination { +.count { + float: left; + font-size: 90%; +} + +.count a, .count span { + text-align: center; + text-decoration: none; + color: #888; + display: inline-block; + float: left; + padding: 0px; + margin: 5px; + border-bottom: 1px solid white; +} + +.count a { + padding: 0 0.5em; +} + +.pages { float: right; font-size: 90%; } -.pagination a, .pagination span { +.pages a, .pages span { text-align: center; text-decoration: none; color: #888; @@ -344,7 +364,7 @@ border-bottom: 1px solid white; } -.pagination a:hover { +.pages a:hover, .count a:hover { border-bottom: 1px solid #888; } @@ -474,7 +494,6 @@ .query { font-size: 90%; - margin: 0.5em 0; } /* select elements are replaced with js equivalents. avoid jumpiness */ diff -r 2429e9db4f34 -r 498ed3c29a0a src/ltpdarepo/templates/browse.html --- a/src/ltpdarepo/templates/browse.html Wed Oct 26 20:13:12 2011 +0200 +++ b/src/ltpdarepo/templates/browse.html Thu Nov 03 20:30:46 2011 +0100 @@ -1,1 +1,2 @@ {% extends "objs.html" %} +{% block above %}

 

{% endblock %} diff -r 2429e9db4f34 -r 498ed3c29a0a src/ltpdarepo/templates/objs.html --- a/src/ltpdarepo/templates/objs.html Wed Oct 26 20:13:12 2011 +0200 +++ b/src/ltpdarepo/templates/objs.html Thu Nov 03 20:30:46 2011 +0100 @@ -4,8 +4,6 @@ {% block body %}

{% block pagetitle %}Database «{{ database.id }}»{% endblock %}

{{ database.description }}

-

{{ batch.count }} objects

- {% block above %}{% endblock %} {% if objs %} {{ pagination.render(batch) }} diff -r 2429e9db4f34 -r 498ed3c29a0a src/ltpdarepo/templates/pagination.html --- a/src/ltpdarepo/templates/pagination.html Wed Oct 26 20:13:12 2011 +0200 +++ b/src/ltpdarepo/templates/pagination.html Thu Nov 03 20:30:46 2011 +0100 @@ -1,5 +1,16 @@ {% macro render(pagination) %} -