aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan <me@jordan.im>2021-12-20 14:09:46 -0700
committerJordan <me@jordan.im>2021-12-20 14:09:46 -0700
commitb8cd19d3ccba302a8f45467bff6a1cd7841a3ef2 (patch)
treedc2023db679a948e13fe31a87ec6d819a470971a
parente75d842f662d9d6a95da6e2ac7a6ee2afdde2115 (diff)
downloadkeep-b8cd19d3ccba302a8f45467bff6a1cd7841a3ef2.tar.gz
keep-b8cd19d3ccba302a8f45467bff6a1cd7841a3ef2.zip
web: housekeeping
-rw-r--r--web.go18
1 files changed, 13 insertions, 5 deletions
diff --git a/web.go b/web.go
index 74ace47..3f5776b 100644
--- a/web.go
+++ b/web.go
@@ -36,6 +36,7 @@ const index = `
display: block;
font-family: monospace;
white-space: wrap;
+ text-align: center;
}
div{
margin: 1em 0;
@@ -73,16 +74,16 @@ const index = `
</head>
<body>
<div>
- <h1 style="text-align:center;">Keep</h1>
- <p style="text-align: center;">{{- .Err -}}</p>
- <p style="text-align: center;">
+ <h1>Keep</h1>
+ <p>{{- .Err -}}</p>
+ <p>
<b>{{- .Stats.URLs -}}</b> URLs,
<b>{{- .Stats.Users -}}</b> users,
<b>{{- .Stats.Guilds -}}</b> guilds,
<b>{{- .Stats.Channels -}}</b> channels
</p>
<div style="padding-top:5px; padding-bottom:5px;">
- <form action="" method="get" style="text-align:center;">
+ <form action="" method="get">
<label for="user">User:</label>
<input type="text" id="user" name="user">
<label for="guild">Guild:</label>
@@ -92,7 +93,7 @@ const index = `
<input type="submit" value="Filter">
</form>
</div>
- <p style="text-align: center;">
+ <p>
{{- if or (ne .User "") (ne .Guild "") (ne .Channel "") -}}
Entries filtered by:
{{- end -}}
@@ -100,6 +101,7 @@ const index = `
{{- if ne .Guild "" }} <b>Guild</b> ({{ .Guild -}}){{- end -}}
{{- if ne .Channel "" }} <b>Channel</b> ({{ .Channel -}}){{- end -}}
</p>
+ {{- if gt (len .Entries) 0 -}}
<div id="navigate">
{{- if gt .Offset 0 -}}
<a href="{{ setQuery .URL "offset" (intToStr (subtract .Offset 100)) }}">Previous</a>
@@ -129,6 +131,11 @@ const index = `
{{- end -}}
</table>
</div>
+ {{- else -}}
+ <p>No results to display</p>
+ <p><a href="./">Home</a></p>
+ {{- end -}}
+ {{- if gt (len .Entries) 0 -}}
<div id="navigate">
{{- if gt .Offset 0 -}}
<a href="{{ setQuery .URL "offset" (intToStr (subtract .Offset 100)) }}">Previous</a>
@@ -138,6 +145,7 @@ const index = `
<a href="{{ setQuery .URL "offset" (intToStr (add .Offset 100)) }}">Next</a>
{{- end -}}
</div>
+ {{- end -}}
</body>
</html>
`