Add edit link to feed footer

This commit is contained in:
Tim Van Baak 2025-02-24 13:21:14 -08:00
parent e242095aba
commit 67760cdedf
3 changed files with 12 additions and 2 deletions

View File

@ -27,19 +27,27 @@
hx-vals='{{ massDeacVars .Items }}'
hx-confirm="Deactivate {{ len .Items }} items?"
>Deactivate All</button>
<br>
{{ if not .LastUpdated.IsZero }}
<br>
last updated {{ .LastUpdated | until }} ({{ .LastUpdated | dateFormat }})
{{ end }}
{{ if .EditLink }}
<br>
<a href="{{ .EditLink }}">edit</a>
{{ end }}
</nav>
{{ else }}
<article class="center">
<span class="feed-controls">Feed is empty</span>
<br>
{{ if not .LastUpdated.IsZero }}
<br>
last updated {{ .LastUpdated | until }} ({{ .LastUpdated | dateFormat }})
{{ end }}
{{ if .EditLink }}
<br>
<a href="{{ .EditLink }}">edit</a>
{{ end }}
</article>
{{ end }}
{{/* end if .Items */}}

View File

@ -123,6 +123,7 @@ type FeedData struct {
Page int
Count int
LastUpdated time.Time
EditLink string
}
func Feed(writer io.Writer, data FeedData) {

View File

@ -45,6 +45,7 @@ func (env *Env) getSource(writer http.ResponseWriter, req *http.Request) {
Page: page,
Count: count,
LastUpdated: lastUpdated,
EditLink: "/source/" + source + "/edit",
}
html.Feed(writer, data)
}