1
0
Fork 0
mirror of https://github.com/Eggbertx/gochan.git synced 2025-09-07 08:36:23 -07:00

Add flag selection to template

This commit is contained in:
Eggbertx 2024-01-21 16:42:01 -08:00
parent 51c884ae6b
commit 6085988889
3 changed files with 22 additions and 0 deletions

BIN
html/static/flags/clown.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 690 B

View file

@ -166,6 +166,9 @@ var funcMap = template.FuncMap{
}
return ipn.String()
},
"customFlagsEnabled": func(board string) bool {
return config.GetBoardConfig(board).CustomFlags != nil
},
"getBoardDirFromID": func(id int) string {
dir, _ := gcsql.GetBoardDir(id)
return dir

View file

@ -15,6 +15,25 @@
<input type="submit" value="{{with .op}}Reply{{else}}Post{{end}}"/></td></tr>
<tr><th class="postblock">Message</th><td><textarea rows="5" cols="35" name="postmsg" id="postmsg"></textarea></td></tr>
<tr><th class="postblock">File</th><td><input name="imagefile" type="file" accept="image/jpeg,image/png,image/gif,video/webm,video/mp4"><input type="checkbox" id="spoiler" name="spoiler"/><label for="spoiler">Spoiler</label></td></tr>
{{- if or (customFlagsEnabled $.board.Dir) $.board.Config.EnableGeoIP -}}
<tr>
<th class="postblock">Flag</th>
<td>
<select name="flag" id="post-flag">
{{- if $.boardConfig.EnableGeoIP -}}
<option value="geoip">Local flag</option>
{{- end -}}
{{- if $.boardConfig.EnableNoFlag -}}
<option value="">No flag</option>
{{- end -}}
{{- range $_,$flag := $.boardConfig.CustomFlags -}}
<option value="{{$flag.Flag}}">{{$flag.Name}}</option>
{{- end -}}
</select>
<img class="flag-preview" src="{{webPath `/static/flags/blank.gif`}}">
</td>
</tr>
{{- end -}}
<tr><th class="postblock">Password</th><td><input type="password" id="postpassword" name="postpassword" size="14" /> (for post/file deletion)</td></tr>
{{if .useCaptcha -}}
<tr><th class="postblock">CAPTCHA</th><td>