aboutsummaryrefslogblamecommitdiff
path: root/pkg/tpl/add.templ
blob: 14b57ebcf3826f99017886d0c1a8e34530820f2c (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16















                                                                                                                       

                                                                                                              

                                                                                                 







                                                  
package tpl

import "fmt"

templ AddQuotePage(form *AddQuoteForm, err string) {
	@Layout(HeaderParams{}) {
		<h2>Добавление цитаты</h2>
		if err != "" {
			<article>
				<header>Ошибка</header>
				{ err }
			</article>
		}
		<form method="post">
			<textarea rows="5" name="quote" placeholder="Текст цитаты">{ form.Quote }</textarea>
			<input type="hidden" name="captcha_id" value={ form.CaptchaID }/>
			<img class="captcha" src={ fmt.Sprintf("/captcha/download/%s.png", form.CaptchaID) }/>
			<input type="text" name="captcha_value" placeholder="Код с картинки"/>
			<input type="submit" value="Отправить на модерацию"/>
		</form>
	}
}

type AddQuoteForm struct {
	Quote        string `form:"quote"`
	CaptchaID    string `form:"captcha_id"`
	CaptchaValue string `form:"captcha_value"`
}