diff options
Diffstat (limited to 'pkg/tpl/quote.templ')
-rw-r--r-- | pkg/tpl/quote.templ | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/pkg/tpl/quote.templ b/pkg/tpl/quote.templ new file mode 100644 index 0000000..459a873 --- /dev/null +++ b/pkg/tpl/quote.templ @@ -0,0 +1,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> + Поделиться: + <a target="_blank" href={ templ.URL(fmt.Sprintf("https://t.me/share/url?url=https://sh.org.ru/%d&text=%s", quote.ID, quote.Quote)) }><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/%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/%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) + } +} |