diff options
Diffstat (limited to 'issues/016-click-task-edit-details.md')
| -rw-r--r-- | issues/016-click-task-edit-details.md | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/issues/016-click-task-edit-details.md b/issues/016-click-task-edit-details.md new file mode 100644 index 0000000..a1687c9 --- /dev/null +++ b/issues/016-click-task-edit-details.md @@ -0,0 +1,80 @@ +# [FEATURE] Click task to open editable details + +## Description +When I click a task, open details and let me update description. + +## User Story +As a user, I want to click a task to view and edit its description inline. + +## Technical Context +- Extends existing task display with detail view +- Requires new endpoints for fetching and updating task details +- HTMX-powered modal or slide-out panel + +## Test Strategy + +### Unit Test (Red) +**File:** `internal/handlers/handlers_test.go` + +```go +func TestUpdateTaskDescription(t *testing.T) { + // Setup mock Todoist client + mockClient := &MockTodoistClient{} + handler := NewHandler(mockClient) + + // Call update endpoint + req := httptest.NewRequest("PUT", "/tasks/123", + strings.NewReader(`{"description": "Updated desc"}`)) + + // Assert Todoist API called with correct params + mockClient.AssertCalled(t, "UpdateTask", "123", "Updated desc") +} +``` + +### E2E Test (Red) +``` +1. Click on a task row +2. Assert modal/drawer opens with task details +3. Assert description field is editable +4. Edit description and save +5. Assert modal closes +6. Assert description persisted (re-open to verify) +``` + +## Proposed Approach + +1. **Endpoints:** + - `GET /tasks/{id}/detail` — fetch task with full details + - `PUT /tasks/{id}` — update task (description, etc.) + +2. **UI Flow:** + - Click task row triggers `hx-get="/tasks/{id}/detail"` + - Response loads into modal or slide-out panel + - Form with editable description (textarea) + - Save button triggers `hx-put="/tasks/{id}"` + - On success, close modal and optionally update task row + +3. **Template:** + - New partial: `partials/task-detail.html` + - Contains: title (read-only or editable), description (editable), due date, labels, save/cancel buttons + +4. **API Integration:** + - Update Todoist via API when saving + - Update local cache + +## Affected Components +- `internal/handlers/handlers.go` (new endpoints) +- `internal/handlers/handlers_test.go` +- `internal/api/todoist.go` (UpdateTask method if not exists) +- `web/templates/partials/task-detail.html` (new) +- `web/templates/partials/todoist-tasks.html` (add click handler) +- `web/templates/index.html` (modal container if needed) + +## Definition of Done +- [ ] Clicking task opens detail view +- [ ] Description field is editable +- [ ] Save persists to Todoist +- [ ] Local cache updated +- [ ] Modal/drawer closes on save +- [ ] Unit tests for update handler +- [ ] E2E test for full flow |
