template changes

This commit is contained in:
Sanj 2012-04-22 20:09:45 +05:30
parent 6634297321
commit 6aac2b4580
2 changed files with 22 additions and 2 deletions

View File

@ -215,6 +215,10 @@ def shipList(request):
'page': page, 'page': page,
'page_size': page_size, 'page_size': page_size,
'no_of_results': no_of_results, '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 'params': request.GET
}) })

View File

@ -1,6 +1,7 @@
<!doctype html> <!doctype html>
<html> <html>
<head> <head>
<meta charset="utf-8" />
<link rel="stylesheet" href="/media/css/reset.css" /> <link rel="stylesheet" href="/media/css/reset.css" />
<link rel="stylesheet" href="/media/css/main.css" /> <link rel="stylesheet" href="/media/css/main.css" />
<script type="text/javascript" src="/media/js/jquery.js"></script> <script type="text/javascript" src="/media/js/jquery.js"></script>
@ -11,6 +12,20 @@ $(function() {
$goodRow.slideToggle(); $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();
});
}); });
</script> </script>
@ -18,11 +33,12 @@ $(function() {
<body> <body>
<div id="wrapper"> <div id="wrapper">
<div id="status"> <div id="status">
No of results: {{ no_of_results }} &nbsp; displaying page {{ page }} of {{ no_of_pages }} &nbsp; Results per page: {{ page_size }} No of results: {{ no_of_results }} &nbsp; displaying page {{ page }} of {{ no_of_pages }} &nbsp; Results per page: {{ page_size }} &nbsp; {% if has_prev %} <span class="prevBtn pageBtn">Previous Page</span> &nbsp;&nbsp; {% if has_next %} <span class="nextBtn pageBtn">Next Page</span>
</div> </div>
<div id="formDiv"> <div id="formDiv">
<form id="shipFilterForm" action="" method="GET"> <form id="shipFilterForm" action="" method="GET">
<fieldset> <fieldset>
<input type="hidden" id="id_page", name="page" value="{{ params.page }}" />
<label for="id_sort">Sort By:</label> <label for="id_sort">Sort By:</label>
<select id="id_sort" name="sort"> <select id="id_sort" name="sort">
<option value="number" {% ifequal params.sort "number" %} selected="selected" {% endifequal %}>Ship Number Ascending</option> <option value="number" {% ifequal params.sort "number" %} selected="selected" {% endifequal %}>Ship Number Ascending</option>
@ -36,7 +52,7 @@ No of results: {{ no_of_results }} &nbsp; displaying page {{ page }} of {{ no_of
</select> </select>
<label for="id_page_size">Results per page:</label> <label for="id_page_size">Results per page:</label>
<input id="page_size" name="page_size" type="text" size="4" /> <input id="page_size" name="page_size" type="text" value="{{ params.page_size }}" size="4" />
</fieldset> </fieldset>
<fieldset> <fieldset>