feat: set default expiration in select #28

Open
tapiron wants to merge 1 commit from tapiron/coller:feat/display_default_expiration_in_form into main
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.
tapiron added 1 commit 2025-09-12 19:09:36 +02:00
jriou requested changes 2025-09-13 19:18:16 +02:00
@ -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.
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u feat/display_default_expiration_in_form:tapiron-feat/display_default_expiration_in_form
git checkout tapiron-feat/display_default_expiration_in_form
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.