Fix required checkboxes in issue forms (#27592) (#27692)

Backport #27592 by @JakobDev

If you set a checkbox as required in a issue form at the moment, the
checkbox is checked and read only, what does not make much sense. With
this PR, the Checkbox actually needs to be checked. The label supports
now also Markdown. This matches GitHub's behaviour.

And yes, I know the CSS is a ugly workaround. It looks like the given
CSS code is part Fomantic and I don't know how to change that. The
Maintainers are free to change that.


![grafik](https://github.com/go-gitea/gitea/assets/15185051/3f35be75-b0b4-42a7-9048-a4970384a035)

Co-authored-by: JakobDev <jakobdev@gmx.de>
This commit is contained in:
Giteabot 2023-10-19 21:35:29 +08:00 committed by GitHub
parent 89d3766d22
commit 6befca1695
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -1,11 +1,14 @@
<div class="field"> <div class="field">
{{template "repo/issue/fields/header" .}} {{template "repo/issue/fields/header" .}}
{{range $i, $opt := .item.Attributes.options}} {{range $i, $opt := .item.Attributes.options}}
<div class="field"> <div class="field inline">
<div class="ui checkbox"> <div class="ui checkbox gt-mr-0">
<input type="checkbox" name="form-field-{{$.item.ID}}-{{$i}}" {{if $opt.required}}readonly checked{{end}}> <input type="checkbox" name="form-field-{{$.item.ID}}-{{$i}}" {{if $opt.required}}required{{end}}>
<label>{{$opt.label}}</label> <label>{{RenderMarkdownToHtml $.context $opt.label}}</label>
</div> </div>
{{if $opt.required}}
<label class="required"></label>
{{end}}
</div> </div>
{{end}} {{end}}
</div> </div>