fix(settings): parse select as list

This commit is contained in:
Diptesh Choudhuri 2023-01-25 03:14:25 +00:00
parent 69f59a9a16
commit 56c35daed4
2 changed files with 3 additions and 12 deletions

View File

@ -367,19 +367,10 @@ func (h *SettingsHandler) actionAddLabel(w http.ResponseWriter, r *http.Request)
var labels []*models.ProjectLabel
if r.PostFormValue("num_projects") == "multiple" {
for _, key := range r.Form["keys"] {
label := &models.ProjectLabel{
UserID: user.ID,
ProjectKey: key,
Label: r.PostFormValue("value"),
}
labels = append(labels, label)
}
} else {
for _, key := range r.Form["key"] {
label := &models.ProjectLabel{
UserID: user.ID,
ProjectKey: r.PostFormValue("key"),
ProjectKey: key,
Label: r.PostFormValue("value"),
}
labels = append(labels, label)

View File

@ -295,7 +295,7 @@
<input type="hidden" name="num_projects" value="multiple">
<div class="mt-2 w-1/2 space-y-4 text-gray-500 text-sm flex-col flex">
<input class="input-default block" name="value" placeholder="Label" required>
<select name="keys" class="block w-full p-2.5 select-default grow" multiple required>
<select name="key" class="block w-full p-2.5 select-default grow" multiple required>
{{ range $i, $p := .Projects }}
<option value="{{ $p }}">{{ $p }}</option>
{{ end }}