ShOrgRu/pkg/tpl/quote_admin.templ

37 lines
808 B
Text
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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"`
}