1
0

Do not show a current page of a guestbook as a link for visual separation.

This commit is contained in:
Alexander Andreev 2024-06-30 00:42:40 +04:00
parent e313a52daf
commit ea3a0f5828
Signed by: Arav
GPG Key ID: 25969B23DCB5CA34
3 changed files with 7 additions and 3 deletions

View File

@ -140,7 +140,7 @@ func (h *Handlers) Guestbook(w http.ResponseWriter, r *http.Request) {
dwc := dwcaptcha.NewDwellingCaptcha(h.captchaExpire) dwc := dwcaptcha.NewDwellingCaptcha(h.captchaExpire)
_, id := inmemdb.New(r.RemoteAddr, dwc) _, id := inmemdb.New(r.RemoteAddr, dwc)
web.Guestbook(string(id), h.owner, entries, pageCount, r).Render(context.Background(), w) web.Guestbook(string(id), h.owner, entries, pageCount, page, r).Render(context.Background(), w)
} }
func (h *Handlers) GuestbookAdmin(w http.ResponseWriter, r *http.Request) { func (h *Handlers) GuestbookAdmin(w http.ResponseWriter, r *http.Request) {

View File

@ -81,7 +81,7 @@ article div.reply > * { margin-left: .5rem; }
article p.quote { font-style: italic; } article p.quote { font-style: italic; }
#pagination a:not(:first-child) { margin-left: .5rem; } #pagination :not(:first-child) { margin-left: .5rem; }
@media screen and (max-width: 641px) { @media screen and (max-width: 641px) {
form { form {

View File

@ -10,7 +10,7 @@ import "git.arav.su/Arav/justguestbook"
import "git.arav.su/Arav/dwelling-home/pkg/util" import "git.arav.su/Arav/dwelling-home/pkg/util"
templ Guestbook(captchaID, owner string, entries []*justguestbook.Entry, pageCount int64, r *http.Request) { templ Guestbook(captchaID, owner string, entries []*justguestbook.Entry, pageCount, pageCur int64, r *http.Request) {
@base("Guestbook", "This is my guestbook. Welcome.", "guestbook, personal", "/guestbook", guestbookHead()) { @base("Guestbook", "This is my guestbook. Welcome.", "guestbook, personal", "/guestbook", guestbookHead()) {
<form id="new-post" action="/api/guestbook" method="POST"> <form id="new-post" action="/api/guestbook" method="POST">
<input type="text" name="name" maxlength="80" placeholder="Name (Anonymous if left blank)"/> <input type="text" name="name" maxlength="80" placeholder="Name (Anonymous if left blank)"/>
@ -71,6 +71,10 @@ templ Guestbook(captchaID, owner string, entries []*justguestbook.Entry, pageCou
<section id="pagination"> <section id="pagination">
for n := int64(1); n <= pageCount; n++ { for n := int64(1); n <= pageCount; n++ {
{{ strN := strconv.FormatInt(n, 10) }} {{ strN := strconv.FormatInt(n, 10) }}
if n == pageCur {
<span>&nbsp;{ strN }</span>
{{ continue }}
}
<a href={ templ.URL("/guestbook?p=" + strN) }>{ strN }</a> <a href={ templ.URL("/guestbook?p=" + strN) }>{ strN }</a>
} }
</section> </section>