feat: set default expiration in select #28
1 changed files with 3 additions and 3 deletions
fix: avoid double options
commit
ba53cfda22
|
@ -36,9 +36,9 @@
|
|||
</div>
|
||||
<div class="col">
|
||||
<select class="form-select" aria-label="Expiration" id="expiration" name="expiration">
|
||||
<option selected="selected" disabled>{{HumanDuration .Expiration}}</option>
|
||||
{{range .Expirations}}
|
||||
<option value="{{.}}">{{HumanDuration .}}</option>
|
||||
<option disabled>Expiration</option>
|
||||
tapiron marked this conversation as resolved
Outdated
|
||||
{{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
Expiration is included in Expirations resulting in a duplicate entry in the list.
Wouldn't it be better to use a
selected="selected"
attribute when the expiration is the default one instead?Something like:
I'm not sure about the scope of the variables here but that should be doable. That way, we'll still see it's an expiration thanks to the disabled option but it would automatically select the default value set on the server.
Yes, it's better like this, done (just used variable instead of implicit "." to be easier to read)