]> git.ipfire.org Git - ipfire.org.git/commitdiff
people: Add navigation to calls page
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 15 Oct 2018 12:22:10 +0000 (13:22 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 15 Oct 2018 12:22:10 +0000 (13:22 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/templates/people/calls.html
src/web/handlers_base.py

index f95e15f7ad1a7cf32dc26afa2588cbf951419218..6e1f259072bb7f040ec410c9eeb1e93bc3d4c60c 100644 (file)
@@ -7,6 +7,31 @@
                <div class="card-body">
                        <h4>{{ _("Calls on %s") % locale.format_day(date) }}</h4>
 
+                       <nav>
+                               <ul class="pagination justify-content-center">
+                                       {% set yesterday = date - datetime.timedelta(days=1) %}
+                                       {% set tomorrow  = date + datetime.timedelta(days=1) %}
+
+                                       <li class="page-item">
+                                               <a class="page-link" href="/users/{{ account.uid }}/calls/{{ yesterday }}">
+                                                       &laquo; {{ locale.format_day(yesterday) }}
+                                               </a>
+                                       </li>
+
+                                       <li class="page-item active">
+                                               <a class="page-link" href="/users/{{ account.uid }}/calls/{{ date }}" tabindex="-1">
+                                                       {{ locale.format_day(date) }}
+                                               </a>
+                                       </li>
+
+                                       <li class="page-item {% if tomorrow > now %}disabled{% end %}">
+                                               <a class="page-link" href="/users/{{ account.uid }}/calls/{{ tomorrow }}">
+                                                       {{ locale.format_day(tomorrow) }} &raquo;
+                                               </a>
+                                       </li>
+                               </ul>
+                       </nav>
+
                        {% module TalkCDR(account, date=date) %}
                </div>
        </div>
index 6c40868d30d3acb599ae494a45017e7463d5de13..bcb31c16d64cf71d32725f5199d324f963309cea 100644 (file)
@@ -37,13 +37,14 @@ class BaseHandler(tornado.web.RequestHandler):
        def get_template_namespace(self):
                ns = tornado.web.RequestHandler.get_template_namespace(self)
 
-               today = datetime.date.today()
+               now = datetime.date.today()
 
                ns.update({
                        "format_size" : util.format_size,
                        "format_time" : util.format_time,
                        "hostname" : self.hostname,
-                       "year" : today.year,
+                       "now" : now,
+                       "year" : now.year,
                })
 
                return ns