Skip to content

Commit 0c0fcf4

Browse files
Update project settings (#673)
2 parents cf352a6 + 7bb590f commit 0c0fcf4

File tree

3 files changed

+32
-30
lines changed

3 files changed

+32
-30
lines changed

backend/projectify/templatetags/projectify.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ def anchor(href: str, label: str, external: bool = False) -> SafeText:
3636
"""
3737
extra: Union[SafeText, str]
3838
a_extra: Union[SafeText, str]
39+
if href == "":
40+
raise ValueError("Empty href supplied")
3941
try:
4042
url = reverse(href)
4143
except NoReverseMatch:

backend/projectify/workspace/templates/workspace/workspace_settings_projects.html

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,27 @@
88
{% blocktrans with workspace_title=workspace.title %}{{ workspace_title }} projects - Projectify{% endblocktrans %}
99
{% endblock title %}
1010
{% block workspace_settings_content %}
11-
<section class="flex flex-col gap-4">
12-
<h2>{% translate "Projects" %}</h2>
13-
<table class="grid w-full grid-cols-4">
11+
<section class="flex flex-col gap-2">
12+
<h2 class="font-bold text-lg">{% translate "Projects" %}</h2>
13+
<table class="grid w-full gap-x-2 gap-y-3 grid-cols-[3fr_max-content]">
1414
<thead class="contents">
1515
<tr class="contents">
16-
<th class="text-left col-span-2">{% translate "Project name" %}</th>
17-
<th></th>
16+
<th class="text-left">{% translate "Project name" %}</th>
1817
<th></th>
1918
</tr>
2019
</thead>
2120
<tbody class="contents">
2221
{% for project in projects %}
2322
<tr class="contents">
24-
<td class="col-span-2">{{ project }}</td>
25-
<td>
23+
<td>{{ project }}</td>
24+
<td class="flex gap-4 items-center">
2625
{% has_perm "workspace.update_project" user project as can_update_project %}
2726
{% if can_update_project %}
2827
{% url 'dashboard:projects:update' project_uuid=project.uuid as update_url %}
2928
{% anchor href=update_url label=_("Update") %}
30-
{% endif %}
31-
</td>
32-
<td>
33-
{% has_perm "workspace.update_project" user project as can_update_project %}
34-
{# XXX limitation: This only works if javascript is enabled #}
35-
{% if can_update_project %}
29+
{# XXX limitation: This only works if javascript is enabled #}
3630
<button hx-post="{% url 'dashboard:projects:archive' project_uuid=project.uuid %}"
37-
hx-confirm="{% translate 'Are you sure you want to archive this project?' %}"
31+
hx-confirm="{% blocktranslate with project=project.title %}Are you sure you want to archive the '{{ project }}' project?{% endblocktranslate %}"
3832
hx-target="closest tr"
3933
hx-swap="outerHTML"
4034
class="text-red-600 hover:text-red-800">{% translate "Archive" %}</button>
@@ -45,35 +39,32 @@ <h2>{% translate "Projects" %}</h2>
4539
</tbody>
4640
</table>
4741
</section>
48-
<section class="flex flex-col gap-4">
49-
<h2>{% translate "Archived projects" %}</h2>
50-
<table class="grid w-full grid-cols-4">
42+
<section class="flex flex-col gap-2">
43+
<h2 class="font-bold text-lg">{% translate "Archived projects" %}</h2>
44+
<table class="grid w-full gap-x-2 gap-y-3 grid-cols-[3fr_max-content]">
5145
<thead class="contents">
5246
<tr class="contents">
53-
<th class="text-left col-span-2">{% translate "Project name" %}</th>
54-
<th></th>
47+
<th class="text-left">{% translate "Project name" %}</th>
5548
<th></th>
5649
</tr>
5750
</thead>
5851
<tbody class="contents">
5952
{% for archived_project in archived_projects %}
6053
<tr class="contents">
61-
<td class="col-span-2">{{ archived_project }}</td>
62-
<td>
54+
<td>{{ archived_project }}</td>
55+
<td class="flex gap-4 items-center">
6356
{% has_perm "workspace.update_project" user project as can_update_project %}
6457
{% if can_update_project %}
6558
<button hx-post="{% url 'dashboard:projects:recover' project_uuid=archived_project.uuid %}"
66-
hx-confirm="{% translate 'Are you sure you want to recover this project?' %}"
59+
hx-confirm="{% blocktranslate with project=archived_project.title %}Are you sure you want to recover the '{{ project }}' project?{% endblocktranslate %}"
6760
hx-target="closest tr"
6861
hx-swap="outerHTML"
6962
class="text-green-600 hover:text-green-800">{% translate "Recover" %}</button>
7063
{% endif %}
71-
</td>
72-
<td>
73-
{% has_perm "workspace.update_project" user project as can_update_project %}
74-
{% if can_update_project %}
64+
{% has_perm "workspace.delete_project" user project as can_delete_project %}
65+
{% if can_delete_project %}
7566
<button hx-post="{% url 'dashboard:projects:delete' project_uuid=archived_project.uuid %}"
76-
hx-confirm="{% translate 'Are you sure you want to permanently delete this project? This action cannot be undone.' %}"
67+
hx-confirm="{% blocktranslate with project=archived_project.title %}Are you sure you want to permanently delete the '{{ project }}' project? This action cannot be undone. {% endblocktranslate %}"
7768
hx-target="closest tr"
7869
hx-swap="outerHTML"
7970
class="text-red-600 hover:text-red-800">{% translate "Delete" %}</button>
@@ -84,4 +75,13 @@ <h2>{% translate "Archived projects" %}</h2>
8475
</tbody>
8576
</table>
8677
</section>
78+
<hr>
79+
<section class="flex flex-col gap-2">
80+
<strong>{% trans "Help" %}</strong>
81+
<ul class="flex list-inside list-disc flex-col gap-2">
82+
<li>
83+
{% url 'help:detail' page='projects' as help_url %}{% anchor href=help_url label=_("About projects") external=True %}
84+
</li>
85+
</ul>
86+
</section>
8787
{% endblock workspace_settings_content %}

docs/remove-fe-overlays.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ settings screen that lets you archive projects.
159159
- [x] **View**: Create a project settings view with the address
160160
`/dashboard/workspace/<uuid:workspace_uuid>/settings/projects`
161161
- [x] **Link**: Place **Projects** tab in workspace settings tab list
162-
- [ ] **Page contents**:
162+
- [x] **Page contents**:
163163
- [x] Show active projects in a list. Active projects are projects that the user hasn't archived.
164164
- [x] Show a **Update** and **Archive** button for every active project.
165165
- [x] When pressing the **Update** button, redirect to this address: `/dashboard/project/<uuid:project_uuid>/update`
@@ -175,8 +175,8 @@ settings screen that lets you archive projects.
175175

176176
Things that are left to do:
177177

178-
- [ ] Style section headers **Projects** andd **Archived projects**
179-
- [ ] Style **Archive**, **Recover**, **Delete** buttons
178+
- [x] Style section headers **Projects** and **Archived projects**
179+
- [x] Style **Archive**, **Recover**, **Delete** buttons
180180

181181
## Update project
182182

0 commit comments

Comments
 (0)