feat: set default expiration in select (#28)
All checks were successful
/ pre-commit (push) Successful in 1m10s
All checks were successful
/ pre-commit (push) Successful in 1m10s
No default value in select could be interpreted as ever lasting note. Default value in the select makes that clearer. Co-authored-by: Thibault Piron <thibault.a.piron@gmail.com> Reviewed-on: #28 Reviewed-by: Julien Riou <jriou@monitoring@riou.xyz> Co-authored-by: tapiron <tapiron@monitoring@riou.xyz> Co-committed-by: tapiron <tapiron@monitoring@riou.xyz>
This commit is contained in:
parent
938d10c3a6
commit
33628331f4
2 changed files with 5 additions and 3 deletions
|
@ -189,6 +189,7 @@ type PageData struct {
|
|||
Title string
|
||||
Version string
|
||||
Expirations []int
|
||||
Expiration int
|
||||
Languages []string
|
||||
Err error
|
||||
URL string
|
||||
|
@ -423,6 +424,7 @@ func (s *Server) Start() error {
|
|||
p := PageData{
|
||||
Title: s.config.Title,
|
||||
Expirations: s.config.Expirations,
|
||||
Expiration: s.config.Expiration,
|
||||
Languages: s.config.Languages,
|
||||
}
|
||||
|
||||
|
|
|
@ -36,9 +36,9 @@
|
|||
</div>
|
||||
<div class="col">
|
||||
<select class="form-select" aria-label="Expiration" id="expiration" name="expiration">
|
||||
<option selected="selected" disabled>Expiration</option>
|
||||
{{range .Expirations}}
|
||||
<option value="{{.}}">{{HumanDuration .}}</option>
|
||||
<option disabled>Expiration</option>
|
||||
{{range $exp := .Expirations}}
|
||||
<option {{ if eq $exp $.Expiration }}selected="selected"{{end}} value="{{$exp}}">{{HumanDuration $exp}}</option>
|
||||
{{end}}
|
||||
</select>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue