From d31683d5d5a12d10db7a5e385eff72145a0e9fe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20D=C3=B6ll?= Date: Sun, 21 Jul 2024 19:49:38 +0000 Subject: [PATCH] wip: comment --- internal/controllers/designs/list.go | 5 ---- internal/controllers/designs/show.go | 44 ++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 5 deletions(-) diff --git a/internal/controllers/designs/list.go b/internal/controllers/designs/list.go index d2b254e..3020a8f 100644 --- a/internal/controllers/designs/list.go +++ b/internal/controllers/designs/list.go @@ -30,11 +30,6 @@ func NewListDesignsController(store seed.Database[ports.ReadTx, ports.ReadWriteT // Prepare ... func (l *ListDesignsControllerImpl) Prepare() error { - err := l.BindBody(&l.results) - if err != nil { - return err - } - return l.store.ReadTx(l.Context(), func(ctx context.Context, tx ports.ReadTx) error { return tx.ListDesigns(ctx, &l.results) }) diff --git a/internal/controllers/designs/show.go b/internal/controllers/designs/show.go index 3e7da49..adcd576 100644 --- a/internal/controllers/designs/show.go +++ b/internal/controllers/designs/show.go @@ -9,7 +9,9 @@ import ( "github.com/zeiss/service-lens/internal/ports" htmx "github.com/zeiss/fiber-htmx" + "github.com/zeiss/fiber-htmx/components/buttons" "github.com/zeiss/fiber-htmx/components/cards" + "github.com/zeiss/fiber-htmx/components/forms" ) // ShowDesignControllerImpl ... @@ -102,6 +104,48 @@ func (l *ShowDesignControllerImpl) Get() error { ), ), ), + htmx.FormElement( + htmx.HxPost("/designs/new"), + cards.CardBordered( + cards.CardProps{}, + cards.Body( + cards.BodyProps{}, + forms.FormControl( + forms.FormControlProps{ + ClassNames: htmx.ClassNames{}, + }, + forms.TextareaBordered( + forms.TextareaProps{ + ClassNames: htmx.ClassNames{ + "h-32": true, + }, + Name: "body", + Placeholder: "Start typing...", + }, + ), + forms.FormControlLabel( + forms.FormControlLabelProps{}, + forms.FormControlLabelText( + forms.FormControlLabelTextProps{ + ClassNames: htmx.ClassNames{ + "text-neutral-500": true, + }, + }, + htmx.Text("Supports Markdown."), + ), + ), + ), + cards.Actions( + cards.ActionsProps{}, + buttons.Outline( + buttons.ButtonProps{}, + htmx.Attribute("type", "submit"), + htmx.Text("Comment"), + ), + ), + ), + ), + ), ), ), )