feat: set default expiration in select #28

Merged
jriou merged 2 commits from tapiron/coller:feat/display_default_expiration_in_form into main 2025-09-15 06:51:17 +02:00
Contributor

No default value in select could be interpreted as ever lasting note.
Default value in the select makes that clearer.

No default value in select could be interpreted as ever lasting note. Default value in the select makes that clearer.
jriou requested changes 2025-09-13 19:18:16 +02:00
Dismissed
@ -37,3 +37,3 @@
<div class="col">
<select class="form-select" aria-label="Expiration" id="expiration" name="expiration">
<option selected="selected" disabled>Expiration</option>
<option selected="selected" disabled>{{HumanDuration .Expiration}}</option>
Owner

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:

<option disabled>Expiration</option>
{{range .Expirations}}
 <option {{if eq . .Expiration}}selected="selected"{{end}} value="{{.}}">{{HumanDuration .}}</option>
{{end}}

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.

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: ```html <option disabled>Expiration</option> {{range .Expirations}} <option {{if eq . .Expiration}}selected="selected"{{end}} value="{{.}}">{{HumanDuration .}}</option> {{end}} ``` 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.
Author
Contributor

Yes, it's better like this, done (just used variable instead of implicit "." to be easier to read)

Yes, it's better like this, done (just used variable instead of implicit "." to be easier to read)
tapiron marked this conversation as resolved
jriou approved these changes 2025-09-15 06:50:56 +02:00
jriou left a comment
Owner

LGTM. Thanks for your contribution!

LGTM. Thanks for your contribution!
jriou merged commit 33628331f4 into main 2025-09-15 06:51:17 +02:00
jriou deleted branch feat/display_default_expiration_in_form 2025-09-15 06:51:20 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: jriou/coller#28
No description provided.