[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-bank] 04/05: implement page numbers
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-bank] 04/05: implement page numbers |
Date: |
Mon, 15 Jan 2018 17:08:04 +0100 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository bank.
commit 9d4586a425c182af61c2ef7d39f397124f680b9c
Author: Marcello Stanisci <address@hidden>
AuthorDate: Mon Jan 15 16:10:03 2018 +0100
implement page numbers
---
talerbank/app/templates/public_accounts.html | 2 +-
talerbank/app/views.py | 12 ++++++------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/talerbank/app/templates/public_accounts.html
b/talerbank/app/templates/public_accounts.html
index a059ca2..edbfdbc 100644
--- a/talerbank/app/templates/public_accounts.html
+++ b/talerbank/app/templates/public_accounts.html
@@ -79,7 +79,7 @@
</tbody>
</table>
{% for pagej in pages %}
- <a href="{{ url("public-accounts", name=account.user.username,
page=pagej) }}">pagej</a>
+ <a href="{{ url("public-accounts", name=selected_account.name,
page=pagej) }}">{{ pagej }}</a>
{% endfor %}
{% else %}
<p>No history for account #{{ selected_account.number }} ({{
selected_account.name}}) yet</p>
diff --git a/talerbank/app/views.py b/talerbank/app/views.py
index e45926e..81eeb6d 100644
--- a/talerbank/app/views.py
+++ b/talerbank/app/views.py
@@ -363,14 +363,14 @@ def serve_public_accounts(request, name=None, page=None):
request.session["public_history_account"] = \
len(qs), youngest
- DELTA = 100
+ DELTA = 30
youngest = request.session["public_history_account"][1]
# normalize page
if not page or page in [0, 1]:
page = 1
# page 0 and 1 give both the youngest 100 records.
if page > 1:
- youngest = youngest + (DELTA * page)
+ youngest = youngest - (DELTA * (page - 1)) # goes backwards.
if not user.bankaccount.is_public:
request.session["public_accounts_hint"] = \
True, False, "Could not query private accounts!"
@@ -385,8 +385,8 @@ def serve_public_accounts(request, name=None, page=None):
num_pages = request.session["public_history_account"][0] / DELTA
pages = list(
- range(max(1, page - 3), min(page + 3, int(num_pages))))
-
+ range(max(1, page - 3), min(page + 4, int(num_pages))))
+ print(pages)
context = dict(
public_accounts=public_accounts,
selected_account=dict(
@@ -396,8 +396,8 @@ def serve_public_accounts(request, name=None, page=None):
name=name,
number=user.bankaccount.account_no,
history=history,
- pages=pages
- )
+ ),
+ pages=pages
)
return render(request, "public_accounts.html", context)
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [taler-bank] branch master updated (acdef0d -> beb6279), gnunet, 2018/01/15
- [GNUnet-SVN] [taler-bank] 01/05: history extracting logic goes in one point, and /history calls it now., gnunet, 2018/01/15
- [GNUnet-SVN] [taler-bank] 04/05: implement page numbers,
gnunet <=
- [GNUnet-SVN] [taler-bank] 05/05: fixing the back-and-forth arrows to navigate multiple pages /public-history results., gnunet, 2018/01/15
- [GNUnet-SVN] [taler-bank] 02/05: set the state to implement the "see next page" feature useful when an account's history is too long., gnunet, 2018/01/15
- [GNUnet-SVN] [taler-bank] 03/05: make /<page_number> available, gnunet, 2018/01/15