39 lines
1.4 KiB
Text
39 lines
1.4 KiB
Text
package tpl
|
|
|
|
import (
|
|
"fmt"
|
|
"sh.org.ru/pkg/model"
|
|
"strconv"
|
|
)
|
|
|
|
templ Quote(quote *model.Quote) {
|
|
<article>
|
|
<header>
|
|
<a href={ templ.URL(fmt.Sprintf("/quote/%d", quote.ID)) }>#{ strconv.Itoa(int(quote.ID)) }</a>
|
|
<span><abbr title="Добавлено на сайт">{ quote.CreatedAt.Format("02.01.06") }</abbr></span>
|
|
</header>
|
|
@templ.Raw(quote.Text())
|
|
<footer>
|
|
<span>
|
|
<a target="_blank" href={ templ.URL(fmt.Sprintf("https://t.me/share/url?url=https://sh.org.ru/quote/%d", quote.ID)) }><i class="fa fa-telegram" aria-hidden="true"></i></a> · 
|
|
<a target="_blank" href={ templ.URL(fmt.Sprintf("https://vk.com/share.php?url=https://sh.org.ru/quote/%d", quote.ID)) }><i class="fa fa-vk" aria-hidden="true"></i></a> · 
|
|
<a target="_blank" href={ templ.URL(fmt.Sprintf("https://connect.ok.ru/offer?url=https://sh.org.ru/quote/%d", quote.ID)) }><i class="fa fa-odnoklassniki-square" aria-hidden="true"></i></a>
|
|
</span>
|
|
<span>
|
|
if quote.Archive {
|
|
<abbr title="Цитата из старого цитатника">Архив</abbr>
|
|
}
|
|
</span>
|
|
</footer>
|
|
</article>
|
|
}
|
|
|
|
templ QuotePage(quote *model.Quote) {
|
|
@Layout(HeaderParams{
|
|
Title: "Цитата #" + strconv.Itoa(int(quote.ID)),
|
|
URL: fmt.Sprintf("https://sh.org.ru/quote/%d", quote.ID),
|
|
Description: templ.EscapeString(quote.Quote),
|
|
}) {
|
|
@Quote(quote)
|
|
}
|
|
}
|