package component import ( "forge.cadoles.com/wpetit/clearcase/internal/core/model" "forge.cadoles.com/wpetit/clearcase/internal/http/form" common "forge.cadoles.com/wpetit/clearcase/internal/http/handler/webui/common/component" ) type IssuePageVModel struct { SummaryForm *form.Form IssueForm *form.Form Projects []*model.Project SelectedProjectID string } func NewIssueSummaryForm() *form.Form { return form.New( form.NewField( "project", form.Attrs{}, form.NonEmpty("This field should not be empty"), ), form.NewField( "summary", form.Attrs{ "type": "textarea", "rows": "20", "placeholder": "Write a rapid description of the issue here...", }, form.NonEmpty("This field should not be empty"), ), ) } func NewIssueForm() *form.Form { return form.New( form.NewField( "content", form.Attrs{ "type": "textarea", "rows": "25", }, form.NonEmpty("This field should not be empty"), ), ) } templ IssuePage(vmodel IssuePageVModel) { @common.Page(common.WithTitle("New issue")) {

Describe your request

@common.FormSelect( vmodel.SummaryForm, "issue-project", "project", "Project", common.WithOptions(projectsToOptions(vmodel.Projects)...), common.WithAttrs( "hx-get", string(common.CurrentURL(ctx, common.WithoutValues("project", "*"))), "hx-target", "body", "hx-push-url", "true", ), ) @common.FormTextarea(vmodel.SummaryForm, "issue-summary", "summary", "Summary")

Generated issue

@common.FormTextarea(vmodel.IssueForm, "issue-content", "content", "")
} } func projectsToOptions(projects []*model.Project) []string { options := make([]string, 0, len(projects)*2) for _, p := range projects { options = append(options, p.Label, p.ID) } return options }