aboutsummaryrefslogtreecommitdiff
path: root/pkg/tpl/quote.templ
blob: 58c0d4fb1bf81208bdab6e1546d79236b82b0480 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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></header>
		@templ.Raw(quote.Text())
		<footer>
			Поделиться:&nbsp;
			<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>&nbsp;
			<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>&nbsp;
			<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>
		</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)
	}
}