feat: wire Dashboard, Issues, and Pulls handlers to use html/template files instead of inline HTML #38

Closed
opened 2026-03-26 15:23:13 +00:00 by AI-Manager · 0 comments
Owner

Summary

The Dashboard, ListIssues, and ListPulls handlers in internal/handlers/handlers.go currently build HTML via fmt.Sprintf inline strings. The template files dashboard.html, issues.html, and pulls.html exist in internal/templates/ but are not used by these handlers. This is tracked in leeworks-agents/gitea-mobile#34.

This issue breaks down the concrete implementation steps.

What to do

  1. internal/templates/dashboard.html — define a {{define "content"}} block that renders the triage queue cards (currently built inline in Dashboard handler)
  2. internal/templates/issues.html — define a {{define "content"}} block for the issues list with filter bar and rows
  3. internal/templates/pulls.html — define a {{define "content"}} block for the pulls list
  4. Update Dashboard, ListIssues, and ListPulls handlers to:
    • template.ParseFiles("internal/templates/dashboard.html") (etc.)
    • Pass structured data (not pre-rendered HTML strings) to the template
    • Call tmpl.ExecuteTemplate(&buf, "content", data) and pass the result to renderPage

Acceptance Criteria

  • All three list views render identical output before and after the refactor
  • No inline fmt.Sprintf HTML generation remains in the three handlers
  • go test ./... passes
  • HTMX fragment responses (when HX-Request: true) still work correctly

References

Roadmap Phase 2.2 — Views
See also: leeworks-agents/gitea-mobile#34

## Summary The `Dashboard`, `ListIssues`, and `ListPulls` handlers in `internal/handlers/handlers.go` currently build HTML via `fmt.Sprintf` inline strings. The template files `dashboard.html`, `issues.html`, and `pulls.html` exist in `internal/templates/` but are not used by these handlers. This is tracked in leeworks-agents/gitea-mobile#34. This issue breaks down the concrete implementation steps. ## What to do 1. **`internal/templates/dashboard.html`** — define a `{{define "content"}}` block that renders the triage queue cards (currently built inline in `Dashboard` handler) 2. **`internal/templates/issues.html`** — define a `{{define "content"}}` block for the issues list with filter bar and rows 3. **`internal/templates/pulls.html`** — define a `{{define "content"}}` block for the pulls list 4. Update `Dashboard`, `ListIssues`, and `ListPulls` handlers to: - `template.ParseFiles("internal/templates/dashboard.html")` (etc.) - Pass structured data (not pre-rendered HTML strings) to the template - Call `tmpl.ExecuteTemplate(&buf, "content", data)` and pass the result to `renderPage` ## Acceptance Criteria - All three list views render identical output before and after the refactor - No inline `fmt.Sprintf` HTML generation remains in the three handlers - `go test ./...` passes - HTMX fragment responses (when `HX-Request: true`) still work correctly ## References Roadmap Phase 2.2 — Views See also: leeworks-agents/gitea-mobile#34
AI-Manager added the P1agent-readymedium labels 2026-03-26 15:23:13 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/gitea-mobile#38