From 6aac2b458002f377b0038774e5ebfe89589ee9ae Mon Sep 17 00:00:00 2001 From: Sanj Date: Sun, 22 Apr 2012 20:09:45 +0530 Subject: [PATCH] template changes --- manifests/ships/views.py | 4 ++++ manifests/templates/shipList.html | 20 ++++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/manifests/ships/views.py b/manifests/ships/views.py index e592b36..314d038 100644 --- a/manifests/ships/views.py +++ b/manifests/ships/views.py @@ -215,6 +215,10 @@ def shipList(request): 'page': page, 'page_size': page_size, 'no_of_results': no_of_results, + 'has_next': results.has_next(), + 'next_page': int(page) + 1, + 'previous_page': int(page) - 1, + 'has_previous': results.has_previous(), 'params': request.GET }) diff --git a/manifests/templates/shipList.html b/manifests/templates/shipList.html index d78024b..352d252 100644 --- a/manifests/templates/shipList.html +++ b/manifests/templates/shipList.html @@ -1,6 +1,7 @@ + @@ -11,6 +12,20 @@ $(function() { $goodRow.slideToggle(); }); + $('.prevBtn').click(function() { + var currPage = parseInt($('#id_page').val()); + var prevPage = currPage - 1; + $('#id_page').val(prevPage); + $('#shipFilterForm').submit(); + }); + + $('.nextBtn').click(function() { + var currPage = parseInt($('#id_page').val()); + var nextPage = currPage + 1; + $('#id_page').val(nextPage); + $('#shipFilterForm').submit(); + }); + }); @@ -18,11 +33,12 @@ $(function() {
-No of results: {{ no_of_results }}   displaying page {{ page }} of {{ no_of_pages }}   Results per page: {{ page_size }} +No of results: {{ no_of_results }}   displaying page {{ page }} of {{ no_of_pages }}   Results per page: {{ page_size }}   {% if has_prev %} Previous Page    {% if has_next %} Next Page
+ - +