1
0

Updated guestbook.templ.

This commit is contained in:
Alexander Andreev 2024-06-25 04:37:35 +04:00
parent f8cc6ea427
commit e6af8372b4
Signed by: Arav
GPG Key ID: 25969B23DCB5CA34

View File

@ -3,6 +3,7 @@ package web
import "fmt" import "fmt"
import "strconv" import "strconv"
import "strings" import "strings"
import "time"
import "net/http" import "net/http"
import "git.arav.su/Arav/justguestbook" import "git.arav.su/Arav/justguestbook"
@ -38,29 +39,25 @@ templ Guestbook(captchaID, owner string, entries []*justguestbook.Entry, pageCou
if !entry.HideWebsite { if !entry.HideWebsite {
{{ website = entry.Website }} {{ website = entry.Website }}
} }
{ strconv.FormatInt(entry.ID, 10) } by <span class="highlighted">{ entry.Name }</span> <em>{ website }</em> on <time datetime={ created_tz }>{ created_tz }</time> { strconv.FormatInt(entry.ID, 10) } by <span class="highlighted">{ entry.Name }</span> <em>{ website }</em> on <time datetime={ entry.Created.Format(time.RFC3339) }>{ created_tz }</time>
</header> </header>
for _, line := range strings.Split(entry.Message, "\n") { for _, line := range strings.Split(entry.Message, "\n") {
<p
if len(line) > 0 && line[0] == '>' { if len(line) > 0 && line[0] == '>' {
<p class="quote">{ line }</p> class="quote"
} else { }>{ line }</p>
<p>{ line }</p>
}
} }
if entry.Reply != nil { if entry.Reply != nil {
<div class="reply"> <div class="reply">
<header> <header>
{{ reply_created_tz := util.ToClientTimezone(entry.Reply.Created, r).Format("Monday _2 January 2006 15:04:05 -07:00") }} {{ reply_created_tz := util.ToClientTimezone(entry.Reply.Created, r).Format("Monday _2 January 2006 15:04:05 -07:00") }}
Reply by <span class="highlighted">{ owner }</span> in <time datetime={ reply_created_tz }>{ reply_created_tz }</time> Reply by <span class="highlighted">{ owner }</span> in <time datetime={ entry.Reply.Created.Format(time.RFC3339) }>{ reply_created_tz }</time>
</header> </header>
for _, line := range strings.Split(entry.Reply.Message, "\n") { for _, line := range strings.Split(entry.Reply.Message, "\n") {
<p
if len(line) > 0 && line[0] == '>' { if len(line) > 0 && line[0] == '>' {
<p class="quote">@templ.Raw(line) class="quote"
</p> }>@templ.Raw(line)</p>
} else {
<p>@templ.Raw(line)
</p>
}
} }
</div> </div>
} }