shorgru/pkg/tpl/add.templ

28 lines
856 B
Text
Raw 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 "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"`
}