Expanded entity form support.

This commit is contained in:
mikestefanello 2025-04-12 10:04:15 -04:00
parent 8c4e99fbd0
commit eaa37a0745
2 changed files with 50 additions and 28 deletions

View file

@ -41,6 +41,14 @@ type (
Value string
Help string
}
CheckboxParams struct {
Form form.Form
FormField string
Name string
Label string
Checked bool
}
)
func ControlGroup(controls ...Node) Node {
@ -106,6 +114,26 @@ func Radios(el RadiosParams) Node {
)
}
func Checkbox(el CheckboxParams) Node {
return Div(
Class("field"),
Div(
Class("control"),
Label(
Class("checkbox"),
Input(
Type("checkbox"),
Name(el.Name),
If(el.Checked, Checked()),
Value("true"),
),
Text(" "+el.Label),
),
),
formFieldErrors(el.Form, el.FormField),
)
}
func InputField(el InputFieldParams) Node {
return Div(
Class("field"),