Files
project-work/sources/task-list-mockup-notes.md

7.0 KiB
Raw Permalink Blame History

Task List Mockup — Implementation Notes

Companion to task-list-mockup.html. The mockup is the visual and structural target for the new /tasks/ page; these notes cover the behavior and rules that the HTML can't show on its own.


1. Remove before building

These exist only so the mockup works as a standalone file:

  • Yellow "Mockup controls" bar: simulates user_level, shows the empty state, and prints the GET URL the form would produce.
  • The entire <script> block: client-side sorting, pagination, and the form/link interception. On the real page, all of this happens on the server through normal links and form submits.
  • Sample data: the 10 rows, usernames, project names, task IDs, dates and "142 tasks" total are placeholders.

The Django template code lives in HTML comments throughout the mockup. Use those comments for the real template.


2. Rendering approach

  • Server-rendered: a Django template with a plain GET form, as in the mockup.
  • URL as state: all state (filters, sort, page, page size) lives in the query string.
  • Links: every link rebuilds that query string.

3. Filters

All filters belong to one GET form (action="/tasks/") and are applied with the Apply button.

Param Control Query
status (repeatable) Checkboxes; value = task_status_id task_status_id__in=[...]
assignee Select; value = user id task_assigned_to=<id>
assignee=0 "Unassigned" option task_assigned_to__isnull=True
project Select; value = project_id Tasks linked to that project via ObjectAssignment
start_date <input type="date">, optional task_start_date >= value
end_date <input type="date">, optional task_end_date <= value
  • Empty values: an empty field means no filter. Each date can be used without the other.
  • Assignee options: "All Assignees", then the users with task access in the current user's accessible projects, then "Unassigned".
  • Project options: "All Projects", then the projects the user can reach through their groups (ObjectAssignment).
  • Status options: come from ListOfTaskStatus, ordered by task_status_sort_order.
  • Clear Filters: a link to /tasks/, not a reset button. It drops every query parameter.

4. Sorting

Column sort value
Title task_short_description
Status task_status__task_status_sort_order (workflow order)
Priority task_priority
Assignee task_assigned_to__username
Project project (alias; the view maps it to the project lookup via ObjectAssignment)
Start Date task_start_date
End Date task_end_date
Created date_created
  • Parameter format: ?sort=field sorts ascending (▲ on the header); ?sort=-field sorts descending (▼).
  • Clicking headers: clicking the active column flips its direction. Clicking a different column sorts it ascending.
  • Default: -date_created (newest first).
  • Allowed values: only the eight values above. Anything else falls back to the default; never pass raw input to order_by.
  • Priority: ascending puts Highest (0) first, because lower numbers mean higher priority.
  • Header links: keep all other active parameters and reset to page 1.
  • Current sort in the form: a hidden sort input in the filter form carries the current sort, so Apply and page-size changes keep it.

5. Pagination

  • Page size: page_size accepts 10, 25, 50 or 100, default 25. Any other value falls back to 25.
    • The dropdown sits above the table but belongs to the filter form (form="task-filter-form").
    • It submits on change. This is the only control that submits automatically.
  • Page number: use Paginator.get_page() so a bad or out-of-range page doesn't raise an error.
  • Page numbers shown: paginator.get_elided_page_range(page_obj.number, on_each_side=2, on_ends=1). With 6 or fewer pages, all are shown.
  • Prev / Next: "◀ Prev" is disabled (a <span>, not a link) on page 1, and "Next ▶" on the last page.
  • Links: every page link keeps all filters, sort and page_size, and changes only page.
  • Reset to page 1: Apply, a page-size change, a sort click and Clear Filters all return to page 1.
  • Results count: Showing {{ page_obj.start_index }}–{{ page_obj.end_index }} of {{ page_obj.paginator.count }} tasks.

6. Table rendering

  • Title: task_short_description in bold, with #T-{task_id} in small muted text below it.

  • Status badge: badge badge-{{ task.task_status.task_higher_order_status|lower }}.

    Class Statuses
    badge-backlog New, Backlog
    badge-normal In Progress, Test/Review
    badge-blocked Blocked
    badge-closed Closed
  • Priority: an 8px dot plus the label from {{ task.get_task_priority_display }}. The class comes from the value.

    Class Values
    priority-high 0 Highest, 1 High
    priority-normal 2 Normal
    priority-low 3 Low, 4 Lowest
  • Assignee: the username, or - if unassigned.

  • Dates: formatted Y-m-d.

  • Actions: a "View" button linking to {% url 'task_information' task.task_id %}.

    • The Actions column (col-actions) is pinned to the table's right edge (position: sticky). The other columns scroll sideways inside the table container, so the page itself never scrolls sideways.
  • Empty state: {% empty %} renders one row with colspan="9" and centered "No tasks found". The count reads "Showing 0–0 of 0 tasks".


7. Permissions

  • Database-level filtering: the queryset is limited to tasks from projects the user's groups can reach through ObjectAssignment. Follow the existing sprint_list view, and never filter in the template.
  • Superusers: they skip that filter and see every task and every UI element.
  • user_level: the user's highest task permission across their groups.
Element Shown when
"+ New Task" ({% url 'new_task' %}) user_level >= 3
"View" button user_level >= 1
Filter sidebar Always

8. Styling and theme

  • Colors: use the app's theme colors, not the hex values in the mockup. Those hex values only show what's intended: neutral surfaces, a blue primary, and the badge and priority color groups.
    • Add a --nb-* token for each new color to both src/sass/themes/_light_theme.scss and _dark_theme.scss, and reference it with var(--nb-...).
    • The page must look right in both light and dark themes.
    • Badge text and its background must stay readable in both themes.
  • Where new styles go: a new partial src/sass/components/_task_list.scss, imported in src/sass/main.scss.
  • Existing classes to reuse: btn btn-primary, btn btn-secondary, form-control and badge, plus the app's existing card and spacing styles.
  • Layout:
    • On desktop, a fixed-width sidebar (about 280px) sits beside the table.
    • Below 1024px, the layout stacks into one column.
    • Table cells use 12px 16px padding.