rewrote specs, added new ui generation spec

- task-brief is the essential 3 questions answers
- tdd - is the revised tdd plan
- wireframe-gen - is 1st cut at writing up the mockup instructions
- view-mockup - is the 2nd cut
This commit is contained in:
2026-11-01 14:19:06 -05:00
parent 63453fa3ed
commit eb6677c9fa
4 changed files with 409 additions and 13 deletions

36
sources/task-brief.md Normal file
View File

@@ -0,0 +1,36 @@
────────────────────────────────────────────────────────────────────────
### 1. Task Description
│ NearBeach is a Django/Vue project management tool that currently has
│ task detail views and task creation, but lacks a general task list
│ view for users to see all their tasks across projects. Users must
│ navigate through individual projects or kanban boards to find tasks,
│ which is inefficient for project managers overseeing multiple
│ projects. This task adds a dedicated /tasks/ page with filtering
│ (status, assignee, project, date range), sortable columns, and
│ pagination.
### 2. How to Judge Completion
│ Run the NearBeach setup commands (install, migrate, create superuser,
│ runserver), log in as admin/password, and navigate to /tasks/ — a
│ paginated table of tasks the user has permission to view should
│ appear. Test filtering by status, assignee, project, and date range;
│ verify column headers toggle ascending/descending sort; confirm page
│ size selector (10/25/50/100) and page navigation work. Run python3
│ manage.py test NearBeach.tests.tests_views.tests_task — 10+ new tests
│ covering filtering, sorting, pagination, and permissions should pass.
│ Create a second user without access to a project, log in as them, and
│ verify they cannot see tasks from that project.
### 3. Other Notes for Reviewer
│ NearBeach uses a group-based permission system via ObjectAssignment —
│ users only see tasks from projects their groups are assigned to. The
│ implementation must filter the queryset at the database level (not in
│ templates) following the existing pattern in sprint_list view.
│ Superusers bypass all filters. The task touches Django views,
│ templates, URL routing, forms, and requires comprehensive tests to
│ ensure permission filtering works correctly across all
│ filter/sort/pagination combinations.

View File

@@ -4,6 +4,23 @@
---
## UI Specification
**Wireframe**: `workflows/find-candidate-tasks/stages/04_user-selection/output/task-list-wireframe.html`
The wireframe defines the complete UI:
- **Header**: "All Tasks" title + "+ New Task" button (shown when `user_level >= 3`)
- **Sidebar Filters**: Status (multi-checkbox), Assignee (dropdown), Project (dropdown), Date Range (start/end date inputs), Clear/Apply buttons
- **Table**: Sortable columns (Title, Status, Priority, Assignee, Project, Start Date, End Date, Created, Actions)
- **Status Badges**: Color-coded (To Do, In Progress, In Review, Done, Blocked)
- **Priority**: High/Medium/Low with colored indicators
- **Pagination**: Page size selector (10/25/50/100), page numbers with ellipsis, prev/next
- **Results Info**: "Showing X–Y of Z tasks"
- **Empty State**: "No tasks found" message
**Template must match this wireframe** — not a minimal version.
---
## Test File Location
```
NearBeach/tests/tests_views/tests_task/test_task_list.py
@@ -31,10 +48,20 @@ python3 manage.py test NearBeach.tests.tests_views.tests_task.test_task_list.Tes
> Run it — it should FAIL (no view/URL/template exists yet).
### IMPL PROMPT (after test fails)
> Implement the minimal code to make `test_task_list_url_accessible` pass:
> 1. Add `task_list(request)` view in `NearBeach/views/task_views.py` with `@login_required`, returns render of `NearBeach/tasks/task_list.html` with context `{"nearbeach_title": "All Tasks"}`
> Implement the code to make `test_task_list_url_accessible` pass:
> 1. Add `task_list(request)` view in `NearBeach/views/task_views.py` with `@login_required`, returns render of `NearBeach/tasks/task_list.html` with context including `nearbeach_title`, `tasks` (empty queryset), `filter_form`, `user_level`, `user_group_permissions`
> 2. Add URL route `path("tasks/", views.task_list, name="task_list")` in `NearBeach/urls.py`
> 3. Create minimal template `NearBeach/templates/NearBeach/tasks/task_list.html` extending base, showing "All Tasks" heading
> 3. Create **full template** `NearBeach/templates/NearBeach/tasks/task_list.html` matching the wireframe:
> - Extends base template
> - Header with title + New Task button (conditional on `user_level >= 3`)
> - Sidebar with all filter sections (status checkboxes, assignee dropdown, project dropdown, date range inputs, Clear/Apply buttons)
> - Table with all columns (Title, Status, Priority, Assignee, Project, Start Date, End Date, Created, Actions)
> - Status badges with correct CSS classes (`badge-todo`, `badge-in-progress`, `badge-review`, `badge-done`, `badge-blocked`)
> - Priority indicators with colored dots
> - Pagination controls (page size selector, page numbers with ellipsis, prev/next)
> - Results info line
> - Empty state handling
> - Sortable column headers with ▲/▼ indicators
> 4. Run the test again — should PASS
---
@@ -57,9 +84,8 @@ python3 manage.py test NearBeach.tests.tests_views.tests_task.test_task_list.Tes
> 1. Get user's groups: `UserGroup.objects.filter(is_deleted=False, username=request.user).values('group_id')`
> 2. Get accessible project IDs: `ObjectAssignment.objects.filter(is_deleted=False, group_id__in=user_groups, project_id__isnull=False).values_list('project_id', flat=True).distinct()`
> 3. If superuser: `Task.objects.filter(is_deleted=False)` else: `Task.objects.filter(is_deleted=False, project_id__in=accessible_project_ids)`
> 4. Pass `tasks` queryset to template
> 5. Update template to loop through `tasks` and display `task_short_description`
> 6. Run test — should PASS
> 4. Pass `tasks` queryset to template (template already has the table loop from wireframe — it will render rows automatically)
> 5. Run test — should PASS
---
@@ -76,8 +102,8 @@ python3 manage.py test NearBeach.tests.tests_views.tests_task.test_task_list.Tes
> Add status filtering to `task_list` view:
> 1. Create `TaskFilterForm` in `forms.py` with `status = forms.MultipleChoiceField(choices=ListOfTaskStatus.choices, required=False, widget=forms.CheckboxSelectMultiple)`
> 2. In view: instantiate form with `request.GET`, if valid apply `tasks_qs = tasks_qs.filter(task_status__in=form.cleaned_data['status'])` when status provided
> 3. Pass `filter_form` to template
> 4. Update template: render status checkboxes in sidebar, preserve other filters in form action
> 3. Pass `filter_form` to template (template already has status checkboxes from wireframe — form renders them)
> 4. Ensure form preserves other filter params in hidden inputs
> 5. Run test — should PASS
---
@@ -96,7 +122,7 @@ python3 manage.py test NearBeach.tests.tests_views.tests_task.test_task_list.Tes
> 1. Add `assignee = forms.ChoiceField(choices=[("", "All Assignees"), ("unassigned", "Unassigned")] + dynamic user choices, required=False)` to `TaskFilterForm`
> 2. In view: if `assignee == "unassigned"` → `tasks_qs.filter(assigned_user__isnull=True)`; elif assignee ID → `tasks_qs.filter(assigned_user_id=assignee)`
> 3. Populate assignee choices from users in accessible projects (or all users)
> 4. Update template: assignee dropdown in sidebar
> 4. Pass form to template (template already has assignee dropdown from wireframe)
> 5. Run test — should PASS
---
@@ -114,7 +140,7 @@ python3 manage.py test NearBeach.tests.tests_views.tests_task.test_task_list.Tes
> 1. Add `project = forms.ChoiceField(choices=[("", "All Projects")] + dynamic project choices, required=False)` to `TaskFilterForm`
> 2. In view: if project selected → `tasks_qs.filter(project_id=project)`
> 3. Project choices = user's accessible projects (from Step 2 queryset)
> 4. Update template: project dropdown in sidebar
> 4. Pass form to template (template already has project dropdown from wireframe)
> 5. Run test — should PASS
---
@@ -132,7 +158,7 @@ python3 manage.py test NearBeach.tests.tests_views.tests_task.test_task_list.Tes
> Add date range filtering:
> 1. Add `start_date = forms.DateField(required=False, widget=forms.DateInput(attrs={'type': 'date'}))` and `end_date` to `TaskFilterForm`
> 2. In view: if start_date → `tasks_qs.filter(task_start_date__gte=start_date)`; if end_date → `tasks_qs.filter(task_end_date__lte=end_date)`
> 3. Update template: two date inputs in sidebar
> 3. Pass form to template (template already has date inputs from wireframe)
> 4. Run test — should PASS
---
@@ -153,7 +179,7 @@ python3 manage.py test NearBeach.tests.tests_views.tests_task.test_task_list.Tes
> 1. Add `sort = forms.ChoiceField(choices=[("created", "Created"), ("-created", "Created ↓"), ("start_date", "Start Date"), ("-start_date", "Start Date ↓"), ("end_date", "End Date"), ("-end_date", "End Date ↓"), ("priority", "Priority"), ("-priority", "Priority ↓"), ("status", "Status"), ("-status", "Status ↓"), ("project", "Project"), ("-project", "Project ↓")], required=False)` to form
> 2. In view: parse sort param, apply `.order_by(sort_field)` to queryset
> 3. For priority: custom ordering using `Case/When` (High=1, Medium=2, Low=3)
> 4. Update template: table headers as links with `?sort=...` preserving other filters, show ▲/▼ indicator
> 4. Pass form to template (template already has sortable headers with ▲/▼ from wireframe — just ensure sort links preserve all filter params)
> 5. Run test — should PASS
---
@@ -174,7 +200,7 @@ python3 manage.py test NearBeach.tests.tests_views.tests_task.test_task_list.Tes
> 1. Add `page_size = forms.ChoiceField(choices=[(10, "10"), (25, "25"), (50, "50"), (100, "100")], required=False, initial=25)` to form
> 2. In view: use `Paginator(tasks_qs, page_size)`, get `page_obj = paginator.get_page(page_number)`
> 3. Pass `page_obj`, `paginator`, `page_size` to template
> 4. Update template: pagination controls (prev/next, page numbers with ellipsis, page size selector)
> 4. Template already has pagination controls from wireframe (prev/next, page numbers with ellipsis, page size selector) — ensure pagination links preserve all filter/sort params
> 5. Run test — should PASS
---

View File

@@ -0,0 +1,123 @@
# Task List View Mockup — Design Description
**Project**: NearBeach (Django/Vue project management tool)
**Route**: `/tasks/`
**Purpose**: Centralized, cross-project task list with filtering, sorting, pagination
---
## Page Layout
Two-column responsive layout (sidebar left, table right on desktop; stacked on mobile <1024px).
**Header bar**: "All Tasks" title on left; "+ New Task" button on right (visible only to users with create permission, `user_level >= 3`).
---
## Sidebar Filters (Fixed Width ~280px)
All filters in a single GET form. Five filter sections, each with a label and control:
1. **Status** — Five checkboxes (To Do, In Progress, In Review, Done, Blocked). Multi-select. Values come from `ListOfTaskStatus` model.
2. **Assignee** — Dropdown: "All Assignees" + all users who have task access in the current user's accessible projects + "Unassigned" option.
3. **Project** — Dropdown: "All Projects" + projects the user has `ObjectAssignment` access to (via their groups).
4. **Date Range** — Two HTML5 date inputs: "Start Date" (filters `task_start_date >= value`) and "End Date" (filters `task_end_date <= value`). Each optional independently.
5. **Actions** — Two buttons: "Clear Filters" (secondary style, links to base `/tasks/` URL) and "Apply" (primary style, submits form).
---
## Main Table Area
### Results Header
- Left: "Showing X–Y of Z tasks" (uses paginator `start_index`, `end_index`, `count`)
- Right: Page size dropdown (10, 25, 50, 100; default 25). Auto-submits on change.
### Data Table (9 Columns)
| Column | Sortable | Content |
|--------|----------|---------|
| Title | Yes | Bold task short description + small gray task ID (`#T-{id}`) |
| Status | Yes | Colored badge (see badge spec below) |
| Priority | Yes | Colored dot (8px) + text: High (red), Medium (orange), Low (green) |
| Assignee | Yes | Username or em dash if unassigned |
| Project | Yes | Project name |
| Start Date | Yes | YYYY-MM-DD |
| End Date | Yes | YYYY-MM-DD |
| Created | Yes | YYYY-MM-DD |
| Actions | No | "View" button linking to `task_information` for that task |
### Sorting
- Click any sortable header → toggles ASC/DESC.
- URL param: `?sort=field` (asc) or `?sort=-field` (desc).
- Header shows ▲ (asc) or ▼ (desc) next to column name.
- Default sort: `-created` (newest first).
### Status Badges (Exact Colors)
| Status | Background | Text |
|--------|------------|------|
| To Do | `#fff3cd` | `#856404` |
| In Progress | `#cce5ff` | `#004085` |
| In Review | `#e2d9f3` | `#5a32a3` |
| Done | `#d4edda` | `#155724` |
| Blocked | `#f8d7da` | `#721c24` |
CSS classes: `badge badge-todo`, `badge badge-in-progress`, `badge badge-review`, `badge badge-done`, `badge badge-blocked`.
### Priority Indicators
- Colored 8px circle (border-radius 50%) + label.
- High: `#cb2431` • Medium: `#e67e22` • Low: `#28a745`.
- Classes: `priority priority-high/medium/low` with `.priority-indicator` child.
### Empty State
When queryset empty: single row spanning all columns, centered "No tasks found" text.
### Pagination Footer
- "◀ Prev" (disabled on page 1)
- Page numbers: 1 2 3 4 5 … 6 (ellipsis after page 5)
- "Next ▶" (disabled on last page)
- All links preserve every active filter, sort, and page_size query parameter.
---
## Permission-Aware Visibility
| Element | Condition |
|---------|-----------|
| "+ New Task" button | `user_level >= 3` |
| "View" action links | `user_level >= 1` |
| Filter sidebar | Always visible (read-only users can filter) |
`user_level` = max `permission_set__task` across user's groups for accessible projects. Superusers see all tasks and all UI elements.
---
## Design System Conformance
- Buttons: `btn btn-primary` / `btn btn-secondary`
- Form controls: `form-control` class on all inputs/selects
- Table: standard HTML table with 12px 16px cell padding
- Badges: `badge` base + status modifier
- Colors: Primary `#0366d6`, text `#24292e`, borders `#e1e4e8`
- Spacing: 8px base unit, 16px section gaps
---
## What Is Explicitly Excluded
No bulk actions, no column visibility toggle, no saved filter presets, no real-time updates, no drag-and-drop, no live collaboration indicators. This is a read/list view only.
---
## Deliverable Expectation
A single self-contained HTML file with embedded CSS/JS that:
- Renders correctly standalone in a browser
- Uses realistic sample data (8–10 rows covering all 5 statuses and 3 priorities)
- Contains Django template syntax (`{% for %}`, `{% if %}`, form field rendering)
- Matches every component, color, and behavior described above
- Serves as the exact visual and structural target for implementation

View File

@@ -0,0 +1,211 @@
# Wireframe Generation Instructions for Task List View
*Give these to the LLM that will generate the production wireframe*
---
## Context
**Project**: NearBeach (Django/Vue project management tool)
**Feature**: Task List View at `/tasks/` with filtering, sorting, pagination
**Permission Model**: Group-based via `ObjectAssignment` — users see only tasks from projects their groups have access to
---
## Required Wireframe Components
### 1. Page Structure
```
┌─────────────────────────────────────────────────────────────┐
│ Header: "All Tasks" [+ New Task] btn │
├──────────────┬──────────────────────────────────────────────┤
│ │ │
│ SIDEBAR │ MAIN TABLE AREA │
│ (280px) │ │
│ │ ┌────────────────────────────────────────┐ │
│ Filters: │ │ Results: "Showing 1–25 of 142 tasks" │ │
│ • Status │ │ Page size: [25 ▼] │ │
│ ☐ To Do │ └────────────────────────────────────────┘ │
│ ☐ In Prog │ ┌────────────────────────────────────────┐ │
│ ☐ Review │ │ ▼Title ▲Status Priority Assignee... │ │
│ ☐ Done │ │ ────────────────────────────────────── │ │
│ ☐ Blocked │ │ Task Name │ View │ │
│ • Assignee │ │ #T-1247 In Progress ●High Alex ... │ │
│ [All ▼] │ │ Task Name │ View │ │
│ • Project │ │ #T-1245 To Do ●High Sam ... │ │
│ [All ▼] │ │ ... │ │
│ • Date Range│ └────────────────────────────────────────┘ │
│ [from] │ ┌────────────────────────────────────────┐ │
│ [to] │ │ ◀ Prev 1 2 3 4 5 ... 6 Next ▶ │ │
│ [Clear] │ └────────────────────────────────────────┘ │
│ [Apply] │ │
│ │ │
└──────────────┴──────────────────────────────────────────────┘
```
### 2. Sidebar Filters (Exact Fields)
| Filter | Type | Options Source |
|--------|------|----------------|
| **Status** | Multi-checkbox | `ListOfTaskStatus` model (To Do, In Progress, In Review, Done, Blocked) |
| **Assignee** | Single select | Users with task access in user's projects + "Unassigned" |
| **Project** | Single select | Projects user has `ObjectAssignment` access to |
| **Start Date** | Date input | HTML5 `<input type="date">` |
| **End Date** | Date input | HTML5 `<input type="date">` |
| **Actions** | Buttons | "Clear Filters" (secondary), "Apply" (primary) |
### 3. Table Columns (Exact Order + Behavior)
| Column | Sortable | Rendering |
|--------|----------|-----------|
| **Title** | Yes | `<strong>task_short_description</strong><br><small>#T-{task_id}</small>` |
| **Status** | Yes | Badge: `badge-todo`, `badge-in-progress`, `badge-review`, `badge-done`, `badge-blocked` |
| **Priority** | Yes | Colored dot + text: `● High` (red), `● Medium` (orange), `● Low` (green) |
| **Assignee** | Yes | `assigned_user.username` or `—` |
| **Project** | Yes | `project.project_name` |
| **Start Date** | Yes | `task_start_date` (YYYY-MM-DD) |
| **End Date** | Yes | `task_end_date` (YYYY-MM-DD) |
| **Created** | Yes | `created_date` (YYYY-MM-DD) |
| **Actions** | No | `[View]` button → links to `task_information` |
### 4. Status Badge CSS Classes (Must Match)
```css
.badge-todo { background: #fff3cd; color: #856404; }
.badge-in-progress { background: #cce5ff; color: #004085; }
.badge-review { background: #e2d9f3; color: #5a32a3; }
.badge-done { background: #d4edda; color: #155724; }
.badge-blocked { background: #f8d7da; color: #721c24; }
```
### 5. Priority Indicator
```html
<span class="priority priority-high">
<span class="priority-indicator"></span>High
</span>
<!-- priority-medium, priority-low similarly -->
.priority-indicator { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.priority-high .priority-indicator { background: #cb2431; }
.priority-medium .priority-indicator { background: #e67e22; }
.priority-low .priority-indicator { background: #28a745; }
```
### 6. Pagination (Exact Behavior)
- **Page size selector**: 10, 25, 50, 100 (default 25)
- **Page numbers**: 1 2 3 4 5 … 6 (ellipsis after 5)
- **Prev/Next**: Disabled on first/last page
- **All links preserve**: All current filter/sort query params
### 7. Sorting Behavior
- Click column header → toggles ASC/DESC
- URL param: `?sort=created` (asc) or `?sort=-created` (desc)
- Visual indicator: ▲ for asc, ▼ for desc (append to header text)
- Default sort: `-created` (newest first)
### 8. Permission-Aware UI Elements
| Element | Shown When |
|---------|------------|
| **+ New Task button** | `user_level >= 3` (create permission) |
| **Edit/View links in Actions** | `user_level >= 1` (read permission) |
| **Filter sidebar** | Always (read-only users can still filter) |
---
## Technical Requirements
### Template Structure
```html
{% extends "NearBeach/base.html" %}
{% block content %}
<div class="task-list-container">
<header class="task-list-header">...</header>
<div class="task-list-main">
<aside class="task-list-sidebar">
<form method="GET" class="filter-form">
<!-- All filter fields -->
<button type="submit" name="apply">Apply</button>
<a href="{% url 'task_list' %}" class="btn btn-secondary">Clear</a>
</form>
</aside>
<section class="task-list-table-area">
<div class="table-header">
<span class="results-info">Showing {{ page_obj.start_index }}–{{ page_obj.end_index }} of {{ paginator.count }} tasks</span>
<select name="page_size" onchange="this.form.submit()">...</select>
</div>
<table class="task-table">
<thead>
<tr>
<th><a href="?sort=created&...">Title {% if sort == 'created' %}▲{% elif sort == '-created' %}▼{% endif %}</a></th>
<!-- ... all columns -->
</tr>
</thead>
<tbody>
{% for task in page_obj %}
<tr>...</tr>
{% empty %}
<tr><td colspan="9" class="empty-state">No tasks found</td></tr>
{% endfor %}
</tbody>
</table>
<nav class="pagination">
<!-- Prev, page numbers, Next -->
</nav>
</section>
</div>
</div>
{% endblock %}
```
### Form Handling
- All filters in **single `<form method="GET">`** in sidebar
- Pagination links are `<a href="?page=2&status=in_progress&...">` preserving all params
- Page size selector: `<select name="page_size" onchange="this.form.submit()">`
### Responsive Breakpoint
- **≥1024px**: Sidebar left, table right (flex)
- **<1024px**: Sidebar stacks above table (full width)
---
## What NOT to Include
| ❌ Don't Add | Reason |
|-------------|--------|
| Live collaboration indicators | Not in scope |
| Bulk actions (checkboxes + dropdown) | Future enhancement |
| Column visibility toggle | Future enhancement |
| Saved filter presets | Future enhancement |
| Real-time updates (WebSocket) | Not in NearBeach |
| Drag-and-drop reordering | Not a kanban board |
---
## Design System Consistency
**Match NearBeach existing patterns:**
- Button classes: `btn btn-primary`, `btn btn-secondary`
- Form controls: `form-control` class on inputs/selects
- Table: `table` class with `th`/`td` padding 12px 16px
- Badges: `badge` base + `badge-{status}` modifier
- Colors: Use existing CSS variables or match `#0366d6` (primary), `#24292e` (text), `#e1e4e8` (borders)
---
## Deliverable
**Single HTML file** (like the current wireframe) that:
1. Renders correctly standalone (open in browser)
2. Has all CSS embedded (no external dependencies)
3. Includes minimal JS for sort toggle demo
4. Uses realistic sample data (8-10 rows showing all statuses/priorities)
5. Matches the component list above exactly
---
## Prompt to Give the LLM
> "Generate a production-ready HTML wireframe for NearBeach's Task List View at `/tasks/`. Use the specifications in `wireframe-generation-instructions.md`. The wireframe must be a single self-contained HTML file with embedded CSS/JS, matching the exact component list, status badges, priority indicators, pagination, sorting behavior, and permission-aware UI elements described. Use NearBeach's design system (btn, form-control, badge classes). Include realistic sample data demonstrating all 5 statuses and 3 priority levels. The template structure must be Django-ready (show {% for %} loops, {% if %} conditionals for permissions, form field rendering)."