From 788aba3d0d0bc98c0164f87cf3a4941cf4587a54 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Sat, 14 May 2022 21:30:18 -0600 Subject: Fix new index page --- srv/src/api/render.go | 2 +- srv/src/api/tpl/index.html | 48 +++++++++++++++++++++++++++------------------- 2 files changed, 29 insertions(+), 21 deletions(-) (limited to 'srv/src/api') diff --git a/srv/src/api/render.go b/srv/src/api/render.go index 6359505..cacdb26 100644 --- a/srv/src/api/render.go +++ b/srv/src/api/render.go @@ -42,7 +42,7 @@ func mustParseTpl(name string) *template.Template { func (a *api) renderIndexHandler() http.Handler { tpl := mustParseTpl("index.html") - const pageCount = 20 + const pageCount = 10 return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { diff --git a/srv/src/api/tpl/index.html b/srv/src/api/tpl/index.html index b71dc01..1858ea8 100644 --- a/srv/src/api/tpl/index.html +++ b/srv/src/api/tpl/index.html @@ -1,28 +1,36 @@ {{ define "body" }} - -{{ if ge .PrevPage 0 }} -Previous -{{ end }} + {{ if or (ge .PrevPage 0) (ge .NextPage 0) }} +
+ + {{ if ge .PrevPage 0 }} + Newer + {{ end }} + + {{ if ge .NextPage 0 }} + Older + {{ end }} + +
+ {{ end }} -{{ if ge .NextPage 0 }} -Next {{ end }} {{ template "base.html" . }} -- cgit v1.2.3