feat: add text search to All Tasks page

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-03 15:02:32 +00:00
parent 3c0266bc19
commit 4c92e1b39f
2 changed files with 10 additions and 0 deletions

View File

@@ -33,6 +33,7 @@ async def list_tasks(
status: Optional[str] = None,
priority: Optional[str] = None,
context: Optional[str] = None,
search: Optional[str] = None,
sort: str = "sort_order",
db: AsyncSession = Depends(get_db),
):
@@ -40,6 +41,9 @@ async def list_tasks(
where_clauses = ["t.is_deleted = false"]
params = {}
if search:
where_clauses.append("t.title ILIKE :search")
params["search"] = f"%{search}%"
if domain_id:
where_clauses.append("t.domain_id = :domain_id")
params["domain_id"] = domain_id
@@ -97,6 +101,7 @@ async def list_tasks(
return templates.TemplateResponse("tasks.html", {
"request": request, "sidebar": sidebar, "items": items,
"domains": domains, "projects": projects, "context_types": context_types,
"current_search": search or "",
"current_domain_id": domain_id or "",
"current_project_id": project_id or "",
"current_status": status or "",

View File

@@ -13,6 +13,7 @@
<!-- Filters -->
<form class="filters-bar" method="get" action="/tasks">
<input type="text" name="search" value="{{ current_search }}" placeholder="Search tasks..." class="filter-select" style="min-width:160px">
<select name="status" class="filter-select" data-auto-submit onchange="this.form.submit()">
<option value="">All Statuses</option>
<option value="open" {{ 'selected' if current_status == 'open' }}>Open</option>
@@ -46,6 +47,10 @@
<option value="created_at" {{ 'selected' if current_sort == 'created_at' }}>Newest</option>
<option value="title" {{ 'selected' if current_sort == 'title' }}>Title</option>
</select>
<button type="submit" class="btn btn-ghost btn-xs">Search</button>
{% if current_search or current_domain_id or current_project_id or current_status or current_priority or current_context %}
<a href="/tasks" class="btn btn-ghost btn-xs" style="color:var(--red)">Clear</a>
{% endif %}
</form>
<!-- Task List -->