Bundle CaptchaID and Tfunc for _captcha.html (#662)
Cette révision appartient à :
Parent
95bd3011ef
révision
20209508c9
5 fichiers modifiés avec 12 ajouts et 6 suppressions
|
@ -13,6 +13,11 @@ import (
|
|||
"github.com/NyaaPantsu/nyaa/util/languages"
|
||||
)
|
||||
|
||||
type captchaData struct {
|
||||
CaptchaID string
|
||||
T languages.TemplateTfunc
|
||||
}
|
||||
|
||||
var FuncMap = template.FuncMap{
|
||||
"inc": func(i int) int {
|
||||
return i + 1
|
||||
|
@ -203,4 +208,7 @@ var FuncMap = template.FuncMap{
|
|||
}
|
||||
return e
|
||||
},
|
||||
"makeCaptchaData": func(captchaID string, T languages.TemplateTfunc) captchaData {
|
||||
return captchaData{captchaID, T}
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{{define "captcha"}}
|
||||
{{with .Upload}}
|
||||
{{/* unset if user doesn't need captcha */}}
|
||||
{{if ne .CaptchaID ""}}
|
||||
<div class="form-group captcha-container">
|
||||
|
@ -10,4 +9,3 @@
|
|||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
<input name="website_link" id="website_link" class="form-control" type="text" value="{{.WebsiteLink}}">
|
||||
</div>
|
||||
|
||||
{{block "captcha" $}}{{end}}
|
||||
{{block "captcha" (makeCaptchaData .CaptchaID $.T)}}{{end}}
|
||||
|
||||
<button type="submit" class="btn btn-success">{{call $.T "upload"}}</button>
|
||||
<br />
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{{block "captcha" .}}{{end}}
|
||||
{{block "captcha" (makeCaptchaData .CaptchaID $.T)}}{{end}}
|
||||
|
||||
<hr class="colorgraph">
|
||||
<div class="row">
|
||||
|
|
|
@ -189,7 +189,7 @@
|
|||
<label for="comment">{{ if gt .User.ID 0}} {{call $.T "submit_a_comment_as_username" .User.Username}} {{else}} {{call $.T "submit_a_comment_as_anonymous"}} {{end}}</label>
|
||||
<textarea name="comment" class="form-control" rows="5"></textarea>
|
||||
</div>
|
||||
{{block "captcha" .}}{{end}}
|
||||
{{block "captcha" (makeCaptchaData .CaptchaID $.T)}}{{end}}
|
||||
<button type="submit" class="btn btn-success">{{call $.T "submit" }}</button>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -211,7 +211,7 @@
|
|||
<input type="radio" name="report_type" value="spam" id="spam" required> <label for="spam">{{ call $.T "spam_garbage" }}</label><br />
|
||||
<input type="radio" name="report_type" value="wrongcat" id="wrongcat" required> <label for="wrongcat">{{ call $.T "wrong_category" }}</label><br />
|
||||
<input type="radio" name="report_type" value="dup" id="dup" required> <label for="dup">{{ call $.T "duplicate_deprecated" }}</label><br />
|
||||
{{block "captcha" .}}{{end}}
|
||||
{{block "captcha" (makeCaptchaData .CaptchaID $.T)}}{{end}}
|
||||
<button type="submit" class="btn btn-default">{{ call $.T "report_btn" }}</button>
|
||||
</form> <br />
|
||||
</div>
|
||||
|
|
Référencer dans un nouveau ticket