From 0c56c4c2b67b245194d6f10c9e5e0f0fe26ec50e Mon Sep 17 00:00:00 2001 From: Ine Maria Nilssen Aanonsen Date: Tue, 24 Feb 2026 15:33:58 +0100 Subject: [PATCH] WEB - DELETE ISSUE --- pkg/web/components/dashboard.templ | 23 +++++++++++++++++++++- pkg/web/components/issue.templ | 13 ++++++++++++ pkg/web/components/issue_detail_card.templ | 11 +++++++++++ pkg/web/handler/issues.go | 5 ++++- pkg/web/routes/issue_detail.templ | 11 ++++++++++- 5 files changed, 60 insertions(+), 3 deletions(-) diff --git a/pkg/web/components/dashboard.templ b/pkg/web/components/dashboard.templ index 1d8e687..fe46929 100644 --- a/pkg/web/components/dashboard.templ +++ b/pkg/web/components/dashboard.templ @@ -57,7 +57,28 @@ templ DashboardPage(props DashboardPageProps) {
if props.SelectedIssue != nil { -
+
+
+ + View full page + + +
@IssueDetailCard(IssueDetailCardProps{ Issue: *props.SelectedIssue, DisplayOwner: props.DisplayOwner, diff --git a/pkg/web/components/issue.templ b/pkg/web/components/issue.templ index 88a113b..9c92417 100644 --- a/pkg/web/components/issue.templ +++ b/pkg/web/components/issue.templ @@ -92,6 +92,7 @@ templ IssueTable(props IssueTableProps) { base.PlainText("Status"), base.PlainText("Type"), base.PlainText("Priority"), + base.PlainText("Actions"), }, []templ.Component{ IssueRows(props.Issues), @@ -124,6 +125,18 @@ templ IssueRows(issues []models.Issue) { { string(issue.Status) } { string(issue.IssueType) } { fmt.Sprintf("P%d", issue.Priority) } + + + } } diff --git a/pkg/web/components/issue_detail_card.templ b/pkg/web/components/issue_detail_card.templ index bba2d18..865585f 100644 --- a/pkg/web/components/issue_detail_card.templ +++ b/pkg/web/components/issue_detail_card.templ @@ -29,6 +29,17 @@ templ IssueDetailCard(props IssueDetailCardProps) {
}
+
+ +
Created diff --git a/pkg/web/handler/issues.go b/pkg/web/handler/issues.go index 28f2902..920a880 100644 --- a/pkg/web/handler/issues.go +++ b/pkg/web/handler/issues.go @@ -176,6 +176,7 @@ func UpdateIssue(w http.ResponseWriter, r *http.Request) { func DeleteIssue(w http.ResponseWriter, r *http.Request) { issue := r.Context().Value(issueKey).(*models.Issue) + hx := HTMX(r) app := App(r) if err := app.Issues.DeleteIssue(r.Context(), issue.ID); err != nil { @@ -183,7 +184,9 @@ func DeleteIssue(w http.ResponseWriter, r *http.Request) { return } - w.Header().Set("Content-Type", "application/json") + if hx.IsHxRequest() { + w.Header().Set("HX-Redirect", "/dashboard") + } w.WriteHeader(http.StatusNoContent) } diff --git a/pkg/web/routes/issue_detail.templ b/pkg/web/routes/issue_detail.templ index 25d8c32..9a6d418 100644 --- a/pkg/web/routes/issue_detail.templ +++ b/pkg/web/routes/issue_detail.templ @@ -14,7 +14,7 @@ type IssueDetailProps struct { templ IssueDetailContent(props IssueDetailProps) {