author Tero Marttila <terom@fixme.fi>
Fri, 13 Feb 2009 00:29:47 +0200
changeset 121 86aebc9cb60b
parent 107 67f48e288102
permissions -rw-r--r--
some quickfixes to fix deployment errors
## special overrides...
<%def name="paginate_left()">


<%def name="paginate(url, count, page_cur, page_max, _more=None, _last=False, **args)">
        Pagination works using page numbers, with a specific number of maximum pages displayed. If _more is True,
        then instead of a "Next" button, we have a "More" button, which goes to the max+1'th page, unless _last is
        True, whereupon it's not displayed.

        Can be called using <%call>, whereupon caller.left/caller.right can define additional data to display at the
        left/right of the pagination ul.
    <div class="paginate">
        % if caller and caller.right :
            <li class="paginate-right">
        % endif
        % if caller and caller.left :
            <li class="paginate-left">
        % endif
            % if page_cur > 1 :
                <a href="${h.build_url(url, count=count, page=page_cur-1, max=max, **args)}">&laquo; Prev</a>
            % else :
                <span>&laquo; Prev</span>
        % for page in xrange(1, page_max + 1) :
            % if page == page_cur :
            % else :
                <a href="${h.build_url(url, count=count, page=page, max=page_max, **args)}">${page}</a>
            % endif
        % endfor
        % if _more and not _last :
        % endif
            % if _more and _last :
                <span>More &raquo;</span>
            % elif _more : 
                <a href="${h.build_url(url, count=count, page=page_max+1, **args)}">More &raquo;</a>
            % elif page_cur == page_max : ## last page
                <span>Next &raquo;</span>
            % else : 
                <a href="${h.build_url(url, count=count, page=page_cur+1, **args)}">Next &raquo;</a>
            % endif