Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 4 additions & 23 deletions backend/projectify/templates/dashboard_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,9 @@
<div class="max-w-xs 2xl:max-w-md">
<nav class="flex flex-col py-4">
<div class="flex flex-col gap-2 px-4 pb-4">
<div class="flex flex-row items-center justify-between gap-4">
{% if workspace %}
<div class="min-w-0 grow">
<button class="flex w-full flex-row items-center justify-between gap-2 rounded-lg border border-border p-2 hover:bg-secondary-hover">
<div class="flex min-w-0 flex-row items-center gap-2">
<div class="h-4 w-4 shrink-0">{% include "heroicons/briefcase.svg" %}</div>
<div class="min-w-0 truncate font-bold">{{ workspace.title }}</div>
</div>
<div class="w-4 h-4 shrink-0">{% include "heroicons/chevron-down.svg" %}</div>
</button>
</div>
<div>
<a href="{% url 'dashboard:workspaces:settings' workspace.uuid %}"
aria-label="Open workspace settings"
class="w-8 h-8 p-1.5 rounded-full border border-transparent text-base-content hover:bg-secondary-hover active:bg-disabled-background disabled:bg-transparent disabled:text-disabled flex items-center justify-center">
{% include "heroicons/dots-horizontal.svg" %}
</a>
</div>
{% else %}
todo no workspace
{% endif %}
</div>
{% if workspace %}
<div class="min-w-0 grow">{% include "workspace/common/sidebar/workspace_details.html" %}</div>
{% endif %}
</div>
<p class="px-4">
{% url "help:detail" page="billing" as trial_workspace_help %}
Expand All @@ -52,7 +33,7 @@
</button>
<div class="flex shrink flex-col">
{% block dashboard_projects %}
{% include "dashboard_projects.html" %}
{% include "workspace/common/sidebar/project_details.html" %}
{% endblock dashboard_projects %}
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions backend/projectify/templates/heroicons/search.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{# SPDX-FileCopyrightText: 2024-2025 JWP Consulting GK #}
{# SPDX-License-Identifier: AGPL-3.0-or-later #}
{% load i18n %}
{% load projectify %}
<form>
<fieldset class="w-full max-w-full">
<legend class="flex items-center gap-2">
<div class="w-4 h-4">{% include "heroicons/user.svg" %}</div>
<p class=" font-bold truncate py-2">{% trans "Filter team members" %}</p>
</legend>
<div class="flex flex-col gap-2">
<div class="flex items-center gap-2">
<div class="w-4 h-4">{% include "heroicons/search.svg" %}</div>
<div class="flex-1">
<input type="text"
name="team-member-name"
class="placeholder:text-task-update-text peer h-full w-full rounded-lg border border-border px-2 py-2" />
</div>
</div>
<div class="flex flex-col overflow-y-auto">
{% for member in team_members %}
<div class="grid grid-cols-[auto_1fr_auto] gap-2 items-center hover:bg-background p-2">
<input type="checkbox"
id="member_{{ member.uuid }}"
name="member_{{ member.uuid }}"
value="{{ member.uuid }}"
class="cursor-pointer" />
<label for="member_{{ member.uuid }}"
class="flex flex-1 gap-2 text-regular min-w-0 cursor-pointer">
{% user_avatar member.user %}
<span class="truncate">{{ member }}</span>
</label>
{# TODO:Add count #}
<div class="flex shrink-0 flex-row items-center gap-2 rounded-2.5xl bg-background px-2 py-0.5 text-primary group-hover:bg-foreground">
111
</div>
</div>
{% endfor %}
</div>
</div>
</fieldset>
</form>
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{# SPDX-License-Identifier: AGPL-3.0-or-later #}
{# SPDX-FileCopyrightText: 2025 JWP Consulting GK #}
{# SPDX-FileCopyrightText: 2024-2025 JWP Consulting GK #}
{% load i18n %}
{# TODO this view should be in projectify/workspace/templates/ #}
{% for project_item in projects %}
<a class="group block flex w-full flex-row justify-between gap-1 px-4 py-1 hover:bg-base-200"
href="{% url "dashboard:projects:detail" project_item.uuid %}">
Expand All @@ -22,3 +21,6 @@
<span class="truncate">{% translate "Create new project" %}</span>
</a>
{% endif %}
{% if team_members %}
{% include "workspace/common/sidebar/filter_team_members.html" %}
{% endif %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{# SPDX-FileCopyrightText: 2024 JWP Consulting GK #}
{# SPDX-License-Identifier: AGPL-3.0-or-later #}
{% load i18n %}
<details name="workspace-select" class="w-full">
<summary class="flex items-center gap-2 hover:bg-secondary-hover font-bold border rounded cursor-pointer p-2">
<div class="h-4 w-4 shrink-0">{% include "heroicons/briefcase.svg" %}</div>
<span class="truncate">{{ workspace.title }}</span>
</summary>
<ul class="flex flex-col max-h-40 overflow-y-auto">
<li class="flex items-center gap-2 border-b">
<a href="{% url 'dashboard:workspaces:settings' workspace.uuid %}"
class="flex w-full flex-row items-center gap-2 px-4 py-2 hover:bg-secondary-hover active:bg-disabled disabled:active:bg-secondary-hover text-base-content">
<div class="h-4 w-4 shrink-0">{% include "heroicons/cog.svg" %}</div>
{% trans "Workspace Settings" %}</a>
</li>
{% for w in workspaces %}
<li>
<a href="{% url "dashboard:workspaces:detail" w.uuid %}"
class="flex w-full flex-row items-center gap-2 px-4 py-2 hover:bg-secondary-hover active:bg-disabled disabled:active:bg-secondary-hover text-base-content">
<div class="h-4 w-4 shrink-0">{% include "heroicons/briefcase.svg" %}</div>
{{ w.title }}</a>
</li>
{% endfor %}
</ul>
</details>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% extends "dashboard_base.html" %}
{% load i18n %}
{% block dashboard_projects %}
{% include "dashboard_projects.html" %}
{% include "workspace/common/sidebar/project_details.html" %}
{% endblock dashboard_projects %}
{% block dashboard_content %}
<div class="min-w-0 grow" role="presentation">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{# SPDX-FileCopyrightText: 2024 JWP Consulting GK #}
{# SPDX-FileCopyrightText: 2024-2025 JWP Consulting GK #}
{# SPDX-License-Identifier: AGPL-3.0-or-later #}
{% extends "dashboard_base.html" %}
{% load i18n %}
Expand Down Expand Up @@ -28,17 +28,7 @@
<!--<InputField>-->
<button type="submit"
class="text-tertiary-content hover:text-tertiary-content-hover active:bg-tertiary-pressed active:text-tertiary-content-hover text-base flex min-w-max flex-row justify-center gap-2 rounded-lg px-4 py-2 font-bold disabled:bg-transparent disabled:text-disabled-content">
<svg fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
width="100%"
height="100%"
class="h-6 w-6">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z">
</path>
</svg>
<span class="h-6 w-6">{% include "heroicons/search.svg" %}</span>
Search tasks
</button>
<!--<button>-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% extends "dashboard_base.html" %}
{% load i18n %}
{% block dashboard_projects %}
{% include "dashboard_projects.html" with projects=projects %}
{% include "workspace/common/sidebar/project_details.html" with projects=projects %}
{% endblock dashboard_projects %}
{% block dashboard_content %}
<div class="min-w-0 grow" role="presentation">
Expand Down
14 changes: 5 additions & 9 deletions backend/projectify/workspace/test/views/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ def test_get_project_detail(
django_assert_num_queries: DjangoAssertNumQueries,
) -> None:
"""Test GETting the project detail page."""
with django_assert_num_queries(14):
# Gone up from 14 -> 15, since we fetch all workspaces
with django_assert_num_queries(15):
response = user_client.get(resource_url)
assert response.status_code == 200
assert project.title.encode() in response.content
Expand Down Expand Up @@ -106,18 +107,13 @@ def test_create_project_success(
) -> None:
"""Test successfully creating a project."""
initial_project_count = Project.objects.count()

# XXX 20 queries is a bit excessive
with django_assert_num_queries(20):
with django_assert_num_queries(6):
response = user_client.post(
resource_url,
{"title": "New Test Project"},
follow=True,
resource_url, {"title": "New Test Project"}
)
assert response.status_code == 200
assert response.status_code == 302

assert Project.objects.count() == initial_project_count + 1
assert "New Test Project" in response.content.decode()

def test_create_project_invalid_form(
self,
Expand Down
4 changes: 4 additions & 0 deletions backend/projectify/workspace/views/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from projectify.workspace.selectors.quota import workspace_get_all_quotas
from projectify.workspace.selectors.workspace import (
workspace_find_by_workspace_uuid,
workspace_find_for_user,
)
from projectify.workspace.serializers.base import ProjectBaseSerializer
from projectify.workspace.serializers.project import ProjectDetailSerializer
Expand All @@ -55,6 +56,7 @@ def project_detail_view(
if project is None:
raise Http404(_("No project found for this uuid"))
project.workspace.quota = workspace_get_all_quotas(project.workspace)
workspaces = workspace_find_for_user(who=request.user)
projects = project_find_by_workspace_uuid(
who=request.user,
workspace_uuid=project.workspace.uuid,
Expand All @@ -64,7 +66,9 @@ def project_detail_view(
"project": project,
"labels": list(project.workspace.label_set.values()),
"projects": projects,
"workspaces": workspaces,
"workspace": project.workspace,
"team_members": list(project.workspace.teammember_set.all()),
}
return render(request, "workspace/project_detail.html", context)

Expand Down
Loading