diff options
| author | Claudomator Agent <agent@claudomator> | 2026-03-18 07:06:03 +0000 |
|---|---|---|
| committer | Claudomator Agent <agent@claudomator> | 2026-03-18 07:06:03 +0000 |
| commit | e3195a6534bae000a63e884ff647fac95d9d2498 (patch) | |
| tree | a75534ac746e4054a573978bc550fd2d835de8c4 /internal/handlers/handlers.go | |
| parent | e72305237e16a8c32fb017261cce129a25d70e65 (diff) | |
chore: autocommit uncommitted changes
Diffstat (limited to 'internal/handlers/handlers.go')
| -rw-r--r-- | internal/handlers/handlers.go | 40 |
1 files changed, 8 insertions, 32 deletions
diff --git a/internal/handlers/handlers.go b/internal/handlers/handlers.go index 4988038..39e67c9 100644 --- a/internal/handlers/handlers.go +++ b/internal/handlers/handlers.go @@ -835,12 +835,7 @@ func (h *Handler) HandleGetListsOptions(w http.ResponseWriter, r *http.Request) return } - w.Header().Set("Content-Type", "text/html") - for _, list := range lists { - _, _ = fmt.Fprintf(w, `<option value="%s">%s</option>`, - template.HTMLEscapeString(list.ID), - template.HTMLEscapeString(list.Name)) - } + HTMLResponse(w, h.renderer, "lists-options", lists) } // HandleGetBugs returns the list of reported bugs @@ -850,19 +845,7 @@ func (h *Handler) HandleGetBugs(w http.ResponseWriter, r *http.Request) { JSONError(w, http.StatusInternalServerError, "Failed to fetch bugs", err) return } - - w.Header().Set("Content-Type", "text/html") - if len(bugs) == 0 { - _, _ = fmt.Fprint(w, `<p class="text-gray-500 text-sm">No bugs reported yet.</p>`) - return - } - - for _, bug := range bugs { - _, _ = fmt.Fprintf(w, `<div class="text-sm border-b border-gray-100 py-2"> - <p class="text-gray-900">%s</p> - <p class="text-gray-400 text-xs">%s</p> - </div>`, template.HTMLEscapeString(bug.Description), bug.CreatedAt.Format("Jan 2, 3:04 PM")) - } + HTMLResponse(w, h.renderer, "bugs", bugs) } // HandleReportBug saves a new bug report @@ -919,19 +902,12 @@ func (h *Handler) HandleGetTaskDetail(w http.ResponseWriter, r *http.Request) { } } - html := fmt.Sprintf(` - <div class="p-4"> - <h3 class="font-semibold text-gray-900 mb-3">%s</h3> - <form hx-post="/tasks/update" hx-swap="none" hx-on::after-request="if(event.detail.successful) { closeTaskModal(); htmx.trigger(document.body, 'refresh-tasks'); }"> - <input type="hidden" name="id" value="%s"> - <input type="hidden" name="source" value="%s"> - <label class="block text-sm font-medium text-gray-700 mb-1">Description</label> - <textarea name="description" class="w-full border border-gray-300 rounded-lg px-3 py-2 text-sm mb-3 h-32">%s</textarea> - <button type="submit" class="w-full bg-primary-600 hover:bg-primary-700 text-white px-4 py-2 rounded-lg text-sm font-medium">Save</button> - </form> - </div> - `, template.HTMLEscapeString(title), template.HTMLEscapeString(id), template.HTMLEscapeString(source), template.HTMLEscapeString(description)) - HTMLString(w, html) + HTMLResponse(w, h.renderer, "task-detail", struct { + Title string + ID string + Source string + Description string + }{title, id, source, description}) } // HandleUpdateTask updates a task description |
