Display share status in dashboard

This commit is contained in:
Yohan Boniface 2023-07-17 09:07:31 +02:00
parent 891c23747f
commit 77cedd3288
3 changed files with 11 additions and 9 deletions

View file

@ -131,15 +131,15 @@ class Map(NamedModel):
PRIVATE = 3 PRIVATE = 3
BLOCKED = 9 BLOCKED = 9
EDIT_STATUS = ( EDIT_STATUS = (
(ANONYMOUS, _("Everyone can edit")), (ANONYMOUS, _("Everyone")),
(EDITORS, _("Only editors can edit")), (EDITORS, _("Only editors")),
(OWNER, _("Only owner can edit")), (OWNER, _("Only owner")),
) )
SHARE_STATUS = ( SHARE_STATUS = (
(PUBLIC, _("everyone (public)")), (PUBLIC, _("Everyone (public)")),
(OPEN, _("anyone with link")), (OPEN, _("Anyone with link")),
(PRIVATE, _("editors only")), (PRIVATE, _("Editors only")),
(BLOCKED, _("blocked")), (BLOCKED, _("Blocked")),
) )
slug = models.SlugField(db_index=True) slug = models.SlugField(db_index=True)
description = models.TextField(blank=True, null=True, verbose_name=_("description")) description = models.TextField(blank=True, null=True, verbose_name=_("description"))

View file

@ -5,7 +5,7 @@
<tr> <tr>
<th>{% blocktrans %}Map{% endblocktrans %}</th> <th>{% blocktrans %}Map{% endblocktrans %}</th>
<th>{% blocktrans %}Name{% endblocktrans %}</th> <th>{% blocktrans %}Name{% endblocktrans %}</th>
<th>{% blocktrans %}Status{% endblocktrans %}</th> <th>{% blocktrans %}Who can see / edit{% endblocktrans %}</th>
<th>{% blocktrans %}Last save{% endblocktrans %}</th> <th>{% blocktrans %}Last save{% endblocktrans %}</th>
<th>{% blocktrans %}Owner{% endblocktrans %}</th> <th>{% blocktrans %}Owner{% endblocktrans %}</th>
<th>{% blocktrans %}Actions{% endblocktrans %}</th> <th>{% blocktrans %}Actions{% endblocktrans %}</th>
@ -19,7 +19,7 @@
<td> <td>
<a href="{{ map_inst.get_absolute_url }}">{{ map_inst.name }}</a> <a href="{{ map_inst.get_absolute_url }}">{{ map_inst.name }}</a>
</td> </td>
<td>{{ map_inst.get_edit_status_display }}</td> <td>{{ map_inst.get_share_status_display }} / {{ map_inst.get_edit_status_display }}</td>
<td>{{ map_inst.modified_at }}</td> <td>{{ map_inst.modified_at }}</td>
<td> <td>
<a href="{{ map_inst.owner.get_url }}">{{ map_inst.owner }}</a> <a href="{{ map_inst.owner.get_url }}">{{ map_inst.owner }}</a>

View file

@ -259,3 +259,5 @@ def test_user_dashboard_display_user_maps(client, map):
assert f"{map.get_absolute_url()}?edit" in body assert f"{map.get_absolute_url()}?edit" in body
assert f"{map.get_absolute_url()}?share" in body assert f"{map.get_absolute_url()}?share" in body
assert f"{map.get_absolute_url()}?download" in body assert f"{map.get_absolute_url()}?download" in body
assert "Everyone (public)" in body
assert "Only owner" in body