mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-25 11:16:11 +01:00
Merge pull request '[v9.0/forgejo] Fix boolean inputs in workflow_dispatch' (#5708) from bp-v9.0/forgejo-96c4ca2 into v9.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5708 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
This commit is contained in:
commit
5d211c101f
|
@ -1,5 +1,5 @@
|
|||
// Copyright The Forgejo Authors.
|
||||
// SPDX-License-Identifier: MIT
|
||||
// Copyright 2024 The Forgejo Authors.
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
package actions
|
||||
|
||||
|
@ -43,7 +43,7 @@ func ManualRunWorkflow(ctx *context_module.Context) {
|
|||
|
||||
formKeyGetter := func(key string) string {
|
||||
formKey := "inputs[" + key + "]"
|
||||
return ctx.FormString(formKey)
|
||||
return ctx.Req.PostFormValue(formKey)
|
||||
}
|
||||
|
||||
if err := workflow.Dispatch(ctx, formKeyGetter, ctx.Repo.Repository, ctx.Doer); err != nil {
|
||||
|
|
|
@ -33,7 +33,9 @@
|
|||
{{if eq $val.Type "boolean"}}
|
||||
<div class="ui checkbox">
|
||||
<label><strong>{{if $val.Description}}{{$val.Description}}{{else}}{{$key}}{{end}}</strong></label>
|
||||
<input {{if $val.Required}}required{{end}} type="checkbox" name="inputs[{{$key}}]" {{if eq $val.Default "true"}}checked{{end}}>
|
||||
{{/* These two inputs need to stay in exactly this order (checkbox first, hidden second) or boolean fields wont work correctly! */}}
|
||||
<input type="checkbox" name="inputs[{{$key}}]" value="on" {{if eq $val.Default "true"}}checked{{end}}>
|
||||
<input type="hidden" name="inputs[{{$key}}]" value="off" autocomplete="off">
|
||||
</div>
|
||||
{{else}}
|
||||
<label>{{if $val.Description}}{{$val.Description}}{{else}}{{$key}}{{end}}</label>
|
||||
|
|
Loading…
Reference in a new issue