aboutsummaryrefslogtreecommitdiff
path: root/pkg/tpl/quote_admin.templ
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/tpl/quote_admin.templ')
-rw-r--r--pkg/tpl/quote_admin.templ36
1 files changed, 36 insertions, 0 deletions
diff --git a/pkg/tpl/quote_admin.templ b/pkg/tpl/quote_admin.templ
new file mode 100644
index 0000000..80bafad
--- /dev/null
+++ b/pkg/tpl/quote_admin.templ
@@ -0,0 +1,36 @@
+package tpl
+
+import (
+ "sh.org.ru/pkg/model"
+ "strconv"
+)
+
+templ Admin(quotes []model.Quote, count int) {
+ @Layout(HeaderParams{}) {
+ for _, q := range quotes {
+ @QuoteAdmin(&q)
+ }
+ Всего { strconv.Itoa(count) } цитат.
+ }
+}
+
+templ QuoteAdmin(quote *model.Quote) {
+ <article>
+ <header>#{ strconv.Itoa(int(quote.ID)) }</header>
+ @templ.Raw(quote.Text())
+ <footer>
+ <form method="post" action="/admin/action">
+ <input type="hidden" name="id" value={ strconv.Itoa(int(quote.ID)) }/>
+ <div role="group">
+ <input class="primary" type="submit" name="action" value="approve"/>
+ <input class="secondary" type="submit" name="action" value="decline"/>
+ </div>
+ </form>
+ </footer>
+ </article>
+}
+
+type AdminForm struct {
+ ID int `form:"id"`
+ Action string `form:"action"`
+}