From: djfiander Date: Tue, 19 Feb 2008 22:29:08 +0000 (+0000) Subject: factor out code to move between pages of items X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=9dbd04c34d87ba255b21fcadfbbb6367fd43ddd6;p=Evergreen.git factor out code to move between pages of items git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@8784 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view.html index 8b1141766c..6f944e676d 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view.html @@ -3,6 +3,8 @@ vim:ft=mako: --> <%inherit file='../base.html'/> +<%namespace file='../../common/widgets.html' name='widget' /> + <%def name="page_title()">${_('Picklist')} <%def name="block_content()"> @@ -19,22 +21,11 @@ - +
- <% - c.oils.acq.offset.value = int(c.oils.acq.offset.value) - c.oils.acq.limit.value = int(c.oils.acq.limit.value) - # set up the paging info - paging = _('Entries %(offset)s - %(limit)s') % { - 'offset': c.oils.acq.offset.value + 1, - 'limit': c.oils.acq.limit.value + c.oils.acq.offset.value - } - %> - ${paging} - % if c.oils.acq.offset.value > 0: - « - % endif - » + ${widget.paging(c.oils.acq.offset.value, + c.oils.acq.limit.value, + c.oils.acq.picklist.value.entry_count())} + +<%def name='paging(start, count, max)'> + + + <% + start = int(start) + if (start + count > max): + end = max + else: + end = start + count + # set up the paging info + paging = _('Entries %(offset)d - %(limit)d of %(max)d') % { + 'offset': start + 1, 'limit': end, 'max': max } + %> + + % if start > 0: + « + % endif + + ${paging} + + % if end < max: + » + % endif +