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 "strconv"
import "strings"
import "time"
import "net/http"
import "git.arav.su/Arav/justguestbook"
@ -38,29 +39,25 @@ templ Guestbook(captchaID, owner string, entries []*justguestbook.Entry, pageCou
if !entry.HideWebsite {
{{ 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>
for _, line := range strings.Split(entry.Message, "\n") {
<p
if len(line) > 0 && line[0] == '>' {
<p class="quote">{ line }</p>
} else {
<p>{ line }</p>
}
class="quote"
}>{ line }</p>
}
if entry.Reply != nil {
<div class="reply">
<header>
{{ 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>
for _, line := range strings.Split(entry.Reply.Message, "\n") {
<p
if len(line) > 0 && line[0] == '>' {
<p class="quote">@templ.Raw(line)
</p>
} else {
<p>@templ.Raw(line)
</p>
}
class="quote"
}>@templ.Raw(line)</p>
}
</div>
}