mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-10 04:05:42 +01:00
Allow issue templates to not render title (#22589)
This adds a yaml attribute that will allow the option for when markdown is rendered that the title will be not included in the output Based on work from @brechtvl
This commit is contained in:
parent
642db3c8f7
commit
2903afb78f
2 changed files with 11 additions and 3 deletions
|
@ -259,7 +259,9 @@ func (f *valuedField) WriteTo(builder *strings.Builder) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// write label
|
// write label
|
||||||
|
if !f.HideLabel() {
|
||||||
_, _ = fmt.Fprintf(builder, "### %s\n\n", f.Label())
|
_, _ = fmt.Fprintf(builder, "### %s\n\n", f.Label())
|
||||||
|
}
|
||||||
|
|
||||||
blankPlaceholder := "_No response_\n"
|
blankPlaceholder := "_No response_\n"
|
||||||
|
|
||||||
|
@ -311,6 +313,13 @@ func (f *valuedField) Label() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (f *valuedField) HideLabel() bool {
|
||||||
|
if label, ok := f.Attributes["hide_label"].(bool); ok {
|
||||||
|
return label
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func (f *valuedField) Render() string {
|
func (f *valuedField) Render() string {
|
||||||
if render, ok := f.Attributes["render"].(string); ok {
|
if render, ok := f.Attributes["render"].(string); ok {
|
||||||
return render
|
return render
|
||||||
|
|
|
@ -640,6 +640,7 @@ body:
|
||||||
description: Description of input
|
description: Description of input
|
||||||
placeholder: Placeholder of input
|
placeholder: Placeholder of input
|
||||||
value: Value of input
|
value: Value of input
|
||||||
|
hide_label: true
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
is_number: true
|
is_number: true
|
||||||
|
@ -681,8 +682,6 @@ body:
|
||||||
|
|
||||||
` + "```bash\nValue of id2\n```" + `
|
` + "```bash\nValue of id2\n```" + `
|
||||||
|
|
||||||
### Label of input
|
|
||||||
|
|
||||||
Value of id3
|
Value of id3
|
||||||
|
|
||||||
### Label of dropdown
|
### Label of dropdown
|
||||||
|
|
Loading…
Reference in a new issue