diff --git a/internal/http/handler/webui/common/component/field.templ b/internal/http/handler/webui/common/component/field.templ
index 720d47b..9e4383a 100644
--- a/internal/http/handler/webui/common/component/field.templ
+++ b/internal/http/handler/webui/common/component/field.templ
@@ -21,7 +21,28 @@ templ FormField(form *form.Form, id string, name string, label string) {
}
}
-templ FormTextarea(form *form.Form, id string, name string, label string) {
+type FormTextareaOptions struct {
+ Attrs map[string]any
+}
+
+type FormTextareaOptionFunc func(opts *FormTextareaOptions)
+
+func WithTextareaAttrs(kvAttrs ...any) FormTextareaOptionFunc {
+ return func(opts *FormTextareaOptions) {
+ opts.Attrs = keyValuesToAttrs(kvAttrs)
+ }
+}
+
+func newFormTextareaOptions(funcs ...FormTextareaOptionFunc) *FormTextareaOptions {
+ opts := &FormTextareaOptions{}
+ for _, fn := range funcs {
+ fn(opts)
+ }
+ return opts
+}
+
+templ FormTextarea(form *form.Form, id string, name string, label string, funcs ...FormTextareaOptionFunc) {
+ {{ opts := newFormTextareaOptions(funcs...) }}
{{ field := form.Field(name) }}
if field != nil {
@@ -29,7 +50,7 @@ templ FormTextarea(form *form.Form, id string, name string, label string) {
{{ err, hasErr := form.Error(name) }}
{{ value, hasValue := field.Get("value") }}
-
+
}
}
diff --git a/internal/http/handler/webui/issue/component/issue_page_templ.go b/internal/http/handler/webui/issue/component/issue_page_templ.go
index cf4a1a3..4b088f7 100644
--- a/internal/http/handler/webui/issue/component/issue_page_templ.go
+++ b/internal/http/handler/webui/issue/component/issue_page_templ.go
@@ -120,7 +120,12 @@ func IssuePage(vmodel IssuePageVModel) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = common.FormTextarea(vmodel.SummaryForm, "issue-summary", "summary", "Summary").Render(ctx, templ_7745c5c3_Buffer)
+ templ_7745c5c3_Err = common.FormTextarea(
+ vmodel.SummaryForm, "issue-summary", "summary", "Summary",
+ common.WithTextareaAttrs(
+ "hx-on:change", "onSummaryChange(event)",
+ ),
+ ).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -132,7 +137,7 @@ func IssuePage(vmodel IssuePageVModel) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}