create view mockup and updated specs

This commit is contained in:
2026-11-01 15:08:48 -05:00
parent eb6677c9fa
commit 28899110bf
5 changed files with 498 additions and 31 deletions

View File

@@ -0,0 +1,104 @@
# Conversation Log: NearBeach Review & UI Conventions
Scope: the `NearBeach/` folder in the project-5 worktree (branch `project-5`). The only files written are under `sources/`; no NearBeach code was changed.
---
## 1. Codebase review
**Request:** Review `NearBeach/`, stay inside that folder, then wait.
**Overview:** NearBeach is a Django and Vue 3 project-management app.
- The backend is in `NearBeach/NearBeach/`: models, about 1,200 lines of URL routes, around 35 view modules, and a REST API at `/api/v0/`.
- The frontend is in `src/`, built with Webpack.
- Access is controlled by permission decorators in `decorators/check_user_permissions/`.
**Main findings:**
1. **Wrong object in permission checks (high).** In `partials/generic_permissions.py`, `_fetch_parent_details` loads the wrong model for cards and requirement items:
- for `kanban_card` it runs `KanbanBoard.objects.get(pk=card_id)`
- for `requirement_item` it runs `Requirement.objects.get(...)`
The tag, link and note API routes reach this code, so permission is checked against an unrelated object. If no such object exists, the request fails with a 500 error.
2. **`document_remove` deletes before checking (high).** It soft-deletes the document before confirming the document belongs to the given object. A user with edit rights on one object can delete another object's document.
3. **Response raised as an exception (low).** `raise HttpResponseBadRequest(...)` raises a response object, which isn't an exception, so Python raises a `TypeError` instead.
**Smaller issues:**
- **Unchecked object types:** the type name from the URL isn't validated, so a bad one causes a 500 error.
- **No admin shortcut:** two API permission decorators don't let admins through automatically.
- **Unhandled missing sprint:** `Sprint.objects.get` has no handling for a missing sprint.
- **Users with no groups:** their permission level comes back as `None`, which crashes the comparison with a `TypeError`.
- **Dev settings:** `local/settings.py` has a hardcoded `SECRET_KEY` and `DEBUG=True`.
**Tests:** 114 backend tests ran and all passed. They don't cover the code paths behind the findings above, and the total seems low, so some test folders may not be discovered.
## 2. How users see data
The app has these main views:
- **Dashboard:** My Objects, To Do Today, RFC approvals, Kanban list, bugs, and admin widgets.
- **Record pages:** an information card on top, with tabs underneath (`ParentModules.vue`): Groups & Users, Documents, Links, Customers, Sprints, Misc, Notes, and Delete for level 4.
- **Kanban boards:** cards are dragged between columns and rows.
- **Search and list pages.**
- **Other views:** My Planner, Sprints/Gantt, scheduled objects, profile, admin pages, and public read-only share links.
**Possible security issue:** `search/search.html` puts the user's search text inside a Vue expression with `v-bind:search-input="'{{search_input}}'"`. Because the app compiles its templates in the browser, this could allow cross-site scripting. Not yet tested.
## 3. Search scope
- **Single-type search pages:** customers, organisations, groups, users, permission sets, notifications, sprints and tags. They match on names or text.
- **"List All Objects":** covers only six types: projects, tasks, requirements, requirement items, RFCs and Kanban boards. It matches titles only (or the ID if a word is a number), and every word must match. Results are limited to the user's groups and to open records unless "include closed" is ticked.
- **Not searchable anywhere:** Kanban cards and change tasks. Scheduled objects have a search function but no menu entry.
## 4. Filtering by date or user
Neither is possible in any search.
**Closest existing views:**
- My Planner: the user's own plan, next 7 days.
- Gantt: a timeline for one project's or requirement's sprints.
- Dashboard "My Objects": only the current user's objects.
No screen shows another user's assignments. The data needed already exists (`ObjectAssignment.assigned_user` and the start/end date fields), so the filters could be added by extending `SearchObjectsForm` and `_get_single_search_object`.
## 5. UI conventions guide
**Request:** Find the right way to describe the UX so new views match the existing look and feel.
**Planning:**
- Two read-only explorations mapped the page shell and the Vue component conventions.
- The user chose a **guide only** (no starter files and no CLAUDE.md), stored in **`sources/`**.
**Output:** `sources/NearBeach-UI-conventions.md`. It covers:
- **Page shell and views:** base templates, how Django data is passed into Vue, and view, decorator and URL conventions.
- **Navigation:** adding links to the navbar.
- **Component layout:** the card, the `col-md-4`/`col-md-8` section pattern, read-only rules and lifecycle.
- **Libraries:** Naive UI for inputs only, Bootstrap for everything else, TinyMCE for rich text.
- **Reusable pieces:** modals, tabs, validation, render components and composables.
- **Saving and feedback:** axios with FormData, and toasts.
- **Styling:** `--nb-*` theme variables.
- **Setup:** component registration, the build, and tests.
- **A new-view checklist** and quirks not to copy.
The details were checked against the code, and the TinyMCE toolbar excerpt was corrected after checking.
## 6. Recipe for a global task list
**Request:** A brief, recipe-style explanation of adding a global task list that can be grouped by user, by date or by assignment.
**Answer:** a nine-step recipe:
1. Add URLs.
2. Add a `TaskListForm`.
3. Add a page view and a POST JSON data view. The data view must limit tasks to the user's groups.
4. Add the template.
5. Add `TaskList.vue`.
6. Register it in `components.js` and `app.js`.
7. Add a navbar link.
8. Add backend and frontend tests.
9. Build and check in both themes.
**Follow-up:** the user said "no", then clarified "do not build it". Nothing was built.
---
## Files produced
- `sources/NearBeach-UI-conventions.md`
- `sources/conversation-log-261020.md` (this file)

Binary file not shown.

View File

@@ -0,0 +1,366 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Task List Mockup</title>
<style>
:root {
--page-bg: #f6f8fa;
--surface: #ffffff;
--text: #24292e;
--text-muted: #6a737d;
--border: #e1e4e8;
--primary: #0366d6;
--primary-hover: #0256b9;
--secondary-bg: #fafbfc;
--secondary-hover: #f3f4f6;
--demo-bg: #fff8c5;
--demo-border: #d4a72c;
}
* { box-sizing: border-box; }
body {
margin: 0;
background: var(--page-bg);
color: var(--text);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.5;
}
/* ---------- Mockup-only controls (not part of the real UI) ---------- */
.demo-bar {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px 16px;
padding: 8px 16px;
background: var(--demo-bg);
border-bottom: 1px solid var(--demo-border);
font-size: 13px;
}
.demo-bar strong { font-weight: 600; }
.demo-bar select { padding: 2px 6px; font-size: 13px; }
.demo-output {
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
word-break: break-all;
}
/* ---------- Page ---------- */
.page {
max-width: 1400px;
margin: 0 auto;
padding: 16px;
}
/* Header bar */
.page-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
padding-bottom: 16px;
margin-bottom: 16px;
border-bottom: 1px solid var(--border);
}
.page-header h1 {
margin: 0;
font-size: 24px;
font-weight: 600;
}
/* Two-column layout: sidebar left, table right; stacks below 1024px */
.layout {
display: grid;
grid-template-columns: 280px 1fr;
gap: 16px;
align-items: start;
}
@media (max-width: 1023.98px) {
.layout { grid-template-columns: 1fr; }
}
/* ---------- Buttons & form controls ---------- */
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 6px 16px;
border: 1px solid transparent;
border-radius: 6px;
font-size: 14px;
font-weight: 500;
line-height: 20px;
text-decoration: none;
cursor: pointer;
white-space: nowrap;
}
.btn-primary {
background: var(--primary);
border-color: var(--primary);
color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary {
background: var(--secondary-bg);
border-color: var(--border);
color: var(--text);
}
.btn-secondary:hover { background: var(--secondary-hover); }
.form-control {
display: block;
width: 100%;
padding: 6px 8px;
border: 1px solid var(--border);
border-radius: 6px;
background: var(--surface);
color: var(--text);
font-size: 14px;
font-family: inherit;
}
.form-control:focus {
outline: none;
border-color: var(--primary);
box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.2);
}
/* ---------- Sidebar filters ---------- */
.sidebar {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 6px;
padding: 16px;
}
.filter-section + .filter-section {
margin-top: 16px;
padding-top: 16px;
border-top: 1px solid var(--border);
}
.filter-label {
display: block;
margin: 0 0 8px;
padding: 0;
font-size: 13px;
font-weight: 600;
}
fieldset.filter-section {
margin-left: 0;
margin-right: 0;
margin-bottom: 0;
border-left: 0;
border-right: 0;
border-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-bottom: 0;
}
fieldset.filter-section:first-child { border-top: 0; padding-top: 0; }
.checkbox-list {
display: flex;
flex-direction: column;
gap: 4px;
}
.checkbox-list label {
display: flex;
align-items: center;
gap: 8px;
cursor: pointer;
}
.date-field + .date-field { margin-top: 8px; }
.date-field span {
display: block;
margin-bottom: 4px;
font-size: 12px;
color: var(--text-muted);
}
.filter-actions {
display: flex;
gap: 8px;
}
.filter-actions .btn { flex: 1; }
/* ---------- Main area (placeholder until specified) ---------- */
.main {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 6px;
min-height: 320px;
display: flex;
align-items: center;
justify-content: center;
padding: 16px;
}
.placeholder {
color: var(--text-muted);
text-align: center;
border: 2px dashed var(--border);
border-radius: 6px;
padding: 32px 16px;
width: 100%;
}
</style>
</head>
<body>
<!-- =====================================================================
MOCKUP-ONLY CONTROLS — not part of the real UI. Remove when building.
===================================================================== -->
<div class="demo-bar" role="region" aria-label="Mockup controls">
<strong>Mockup controls</strong>
<label>
Simulated user_level:
<select id="demo-user-level">
<option value="0">0 – no access</option>
<option value="1">1 – read</option>
<option value="2">2 – edit</option>
<option value="3">3 – create</option>
<option value="4" selected>4 – full</option>
</select>
</label>
<span>Last submitted query: <span class="demo-output" id="demo-query">(none)</span></span>
</div>
<div class="page">
<!-- Header bar -->
<header class="page-header">
<h1>All Tasks</h1>
<!-- {% if user_level >= 3 %} -->
<a href="/new_task/" class="btn btn-primary" id="new-task-btn" data-requires-user-level="3">+ New Task</a>
<!-- {% endif %} -->
</header>
<div class="layout">
<!-- ================= Sidebar filters ================= -->
<aside class="sidebar" aria-label="Filters">
<!-- All filters in a single GET form; selections appear in the URL query string. -->
<form method="get" action="/tasks/" id="task-filter-form">
<!-- 1. Status — multi-select checkboxes; values come from ListOfTaskStatus -->
<fieldset class="filter-section">
<legend class="filter-label">Status</legend>
<div class="checkbox-list">
<!-- {% for status in status_options %} -->
<label><input type="checkbox" name="status" value="new"> New</label>
<label><input type="checkbox" name="status" value="backlog"> Backlog</label>
<label><input type="checkbox" name="status" value="blocked"> Blocked</label>
<label><input type="checkbox" name="status" value="in_progress"> In Progress</label>
<label><input type="checkbox" name="status" value="test_review"> Test/Review</label>
<label><input type="checkbox" name="status" value="closed"> Closed</label>
<!-- {% endfor %} -->
</div>
</fieldset>
<!-- 2. Assignee — "All Assignees" + users with task access in the
current user's accessible projects + "Unassigned" -->
<div class="filter-section">
<label class="filter-label" for="filter-assignee">Assignee</label>
<select class="form-control" id="filter-assignee" name="assignee">
<option value="">All Assignees</option>
<!-- {% for user in assignee_options %} -->
<option value="alex.chen">alex.chen</option>
<option value="jordan.lee">jordan.lee</option>
<option value="riley.ng">riley.ng</option>
<option value="sam.patel">sam.patel</option>
<option value="taylor.kim">taylor.kim</option>
<!-- {% endfor %} -->
<option value="unassigned">Unassigned</option>
</select>
</div>
<!-- 3. Project — "All Projects" + projects the user has
ObjectAssignment access to (via their groups) -->
<div class="filter-section">
<label class="filter-label" for="filter-project">Project</label>
<select class="form-control" id="filter-project" name="project">
<option value="">All Projects</option>
<!-- {% for project in project_options %} -->
<option value="1">Website Redesign</option>
<option value="2">Mobile App v2</option>
<option value="3">Data Migration</option>
<option value="4">Internal Tools</option>
<!-- {% endfor %} -->
</select>
</div>
<!-- 4. Date Range — both optional, independently
Start Date: task_start_date >= value
End Date: task_end_date <= value -->
<fieldset class="filter-section">
<legend class="filter-label">Date Range</legend>
<label class="date-field">
<span>Start Date</span>
<input class="form-control" type="date" name="start_date">
</label>
<label class="date-field">
<span>End Date</span>
<input class="form-control" type="date" name="end_date">
</label>
</fieldset>
<!-- 5. Actions -->
<div class="filter-section">
<div class="filter-actions">
<!-- Link (not a reset button) so all query params are cleared -->
<a href="/tasks/" class="btn btn-secondary" id="clear-filters">Clear Filters</a>
<button type="submit" class="btn btn-primary">Apply</button>
</div>
</div>
</form>
</aside>
<!-- ================= Main table area ================= -->
<main class="main">
<div class="placeholder">
Main table area — to be specified<br>
(results header, columns, sorting, pagination)
</div>
</main>
</div>
</div>
<script>
// Mockup-only behaviour. The real page relies on the server for all of this.
(function () {
var levelSelect = document.getElementById('demo-user-level');
var newTaskBtn = document.getElementById('new-task-btn');
var form = document.getElementById('task-filter-form');
var clearLink = document.getElementById('clear-filters');
var queryOut = document.getElementById('demo-query');
// "+ New Task" visible only when user_level >= 3
function applyUserLevel() {
var required = Number(newTaskBtn.dataset.requiresUserLevel);
newTaskBtn.hidden = Number(levelSelect.value) < required;
}
levelSelect.addEventListener('change', applyUserLevel);
applyUserLevel();
// Standalone file has no server: show the GET URL instead of navigating.
form.addEventListener('submit', function (e) {
e.preventDefault();
var params = new URLSearchParams();
new FormData(form).forEach(function (value, key) {
if (value !== '') params.append(key, value);
});
var qs = params.toString();
queryOut.textContent = form.getAttribute('action') + (qs ? '?' + qs : '');
});
clearLink.addEventListener('click', function (e) {
e.preventDefault();
form.reset();
queryOut.textContent = clearLink.getAttribute('href');
});
})();
</script>
</body>
</html>

View File

@@ -1,10 +1,7 @@
# Task List View Mockup — Design Description
# Task List View Mockup - Design
**Project**: NearBeach (Django/Vue project management tool)
**Route**: `/tasks/`
**Purpose**: Centralized, cross-project task list with filtering, sorting, pagination
---
## Page Layout
@@ -18,15 +15,15 @@ Two-column responsive layout (sidebar left, table right on desktop; stacked on m
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.
1. `Status` - six checkboxes (New, Backlog, Blocked, In Progress, Test/Review, Closed). Multi-select. Values come from `ListOfTaskStatus` model (user-configurable; defaults shown).
2. **Assignee** — Dropdown: "All Assignees" + all users who have task access in the current user's accessible projects + "Unassigned" option.
2. `Assignee` - a 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).
3. `Project` - a 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.
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).
5. `Actions` - two buttons: "Clear Filters" (secondary style, links to base `/tasks/` URL) and "Apply" (primary style, submits form).
---
@@ -43,7 +40,7 @@ All filters in a single GET form. Five filter sections, each with a label and co
| 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 |
| Assignee | Yes | Username or hyphen if unassigned |
| Project | Yes | Project name |
| Start Date | Yes | YYYY-MM-DD |
| End Date | Yes | YYYY-MM-DD |
@@ -56,17 +53,16 @@ All filters in a single GET form. Five filter sections, each with a label and co
- Header shows ▲ (asc) or ▼ (desc) next to column name.
- Default sort: `-created` (newest first).
### Status Badges (Exact Colors)
### Status Badges (Exact Colors — Match Higher-Order Status)
| Status | Background | Text |
|--------|------------|------|
| To Do | `#fff3cd` | `#856404` |
| In Progress | `#cce5ff` | `#004085` |
| In Review | `#e2d9f3` | `#5a32a3` |
| Done | `#d4edda` | `#155724` |
| Blocked | `#f8d7da` | `#721c24` |
| Higher-Order Status | Example Statuses | Background | Text | CSS Class |
|---------------------|------------------|------------|------|-----------|
| Backlog | New, Backlog | `#fff3cd` | `#856404` | `badge badge-backlog` |
| Normal | In Progress, Test/Review | `#cce5ff` | `#004085` | `badge badge-normal` |
| Blocked | Blocked | `#f8d7da` | `#721c24` | `badge badge-blocked` |
| Closed | Closed | `#d4edda` | `#155724` | `badge badge-closed` |
CSS classes: `badge badge-todo`, `badge badge-in-progress`, `badge badge-review`, `badge badge-done`, `badge badge-blocked`.
CSS classes use **higher-order status** (4 classes), not individual status names. Template logic: `badge badge-{{ task.task_status.task_higher_order_status|lower }}`.
### Priority Indicators
- Colored 8px circle (border-radius 50%) + label.
@@ -84,7 +80,7 @@ When queryset empty: single row spanning all columns, centered "No tasks found"
---
## Permission-Aware Visibility
## Permission Awareness
| Element | Condition |
|---------|-----------|
@@ -117,7 +113,7 @@ No bulk actions, no column visibility toggle, no saved filter presets, no real-t
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)
- Uses realistic sample data (8–10 rows covering all 6 default 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

@@ -47,7 +47,7 @@
| Filter | Type | Options Source |
|--------|------|----------------|
| **Status** | Multi-checkbox | `ListOfTaskStatus` model (To Do, In Progress, In Review, Done, Blocked) |
| **Status** | Multi-checkbox | `ListOfTaskStatus` model (New, Backlog, Blocked, In Progress, Test/Review, Closed — user-configurable, defaults shown) |
| **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">` |
@@ -59,7 +59,7 @@
| 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` |
| **Status** | Yes | Badge based on `task_higher_order_status`: `badge-backlog` (New, Backlog), `badge-normal` (In Progress, Test/Review), `badge-blocked`, `badge-closed` |
| **Priority** | Yes | Colored dot + text: `● High` (red), `● Medium` (orange), `● Low` (green) |
| **Assignee** | Yes | `assigned_user.username` or `—` |
| **Project** | Yes | `project.project_name` |
@@ -68,16 +68,17 @@
| **Created** | Yes | `created_date` (YYYY-MM-DD) |
| **Actions** | No | `[View]` button → links to `task_information` |
### 4. Status Badge CSS Classes (Must Match)
### 4. Status Badge CSS Classes (Must Match — Based on Higher-Order Status)
```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; }
.badge-backlog { background: #fff3cd; color: #856404; } /* New, Backlog */
.badge-normal { background: #cce5ff; color: #004085; } /* In Progress, Test/Review */
.badge-blocked { background: #f8d7da; color: #721c24; } /* Blocked */
.badge-closed { background: #d4edda; color: #155724; } /* Closed */
```
Template renders: `<span class="badge badge-{{ task.task_status.task_higher_order_status|lower }}">{{ task.task_status.task_status }}</span>`
### 5. Priority Indicator
```html
@@ -202,10 +203,10 @@
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
5. Matches the component list above exactly (6 default statuses, 3 priorities)
---
## 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)."
> "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 (4 higher-order classes), 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 6 default statuses (New, Backlog, Blocked, In Progress, Test/Review, Closed) and 3 priority levels. The template structure must be Django-ready (show {% for %} loops, {% if %} conditionals for permissions, form field rendering). Use higher-order status for badge class: `badge-{{ task.task_status.task_higher_order_status|lower }}`."