terom@107: ## special overrides...
terom@107: <%def name="paginate_left()">
terom@107:
terom@107: %def>
terom@107:
terom@76: <%def name="paginate(url, count, page_cur, page_max, _more=None, _last=False, **args)">
terom@76: <%doc>
terom@76: Pagination works using page numbers, with a specific number of maximum pages displayed. If _more is True,
terom@76: then instead of a "Next" button, we have a "More" button, which goes to the max+1'th page, unless _last is
terom@107: True, whereupon it's not displayed.
terom@107:
terom@107: Can be called using <%call>, whereupon caller.left/caller.right can define additional data to display at the
terom@107: left/right of the pagination ul.
terom@76: %doc>
terom@76:
terom@76:
terom@107: % if caller and caller.right :
terom@107: -
terom@107: ${caller.right()}
terom@107:
terom@107: % endif
terom@107: % if caller and caller.left :
terom@107: -
terom@107: ${caller.left()}
terom@107:
terom@107: % endif
terom@76: -
terom@76: % if page_cur > 1 :
terom@76: « Prev
terom@76: % else :
terom@76: « Prev
terom@76: %endif
terom@76:
terom@76: % for page in xrange(1, page_max + 1) :
terom@76: -
terom@76: % if page == page_cur :
terom@76: ${page}
terom@76: % else :
terom@76: ${page}
terom@76: % endif
terom@76:
terom@76: % endfor
terom@79: % if _more and not _last :
terom@79: - …
terom@79: % endif
terom@76: -
terom@76: % if _more and _last :
terom@76: More »
terom@76: % elif _more :
terom@76: More »
terom@76: % elif page_cur == page_max : ## last page
terom@76: Next »
terom@76: % else :
terom@76: Next »
terom@76: % endif
terom@76:
terom@76:
terom@76:
terom@76: %def>
terom@76: