-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add group leadership list (#8135)
* feat: add Group Leadership list * fix: only offer export to staff * fix: fix export button conditional * fix: improve tests. black format --------- Co-authored-by: Robert Sparks <[email protected]>
- Loading branch information
Showing
4 changed files
with
127 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,6 +65,53 @@ def test_stream_edit(self): | |
self.assertTrue(Role.objects.filter(name="delegate", group__acronym=stream_acronym, email__address="[email protected]")) | ||
|
||
|
||
class GroupLeadershipTests(TestCase): | ||
def test_leadership_wg(self): | ||
# setup various group states | ||
bof_role = RoleFactory( | ||
group__type_id="wg", group__state_id="bof", name_id="chair" | ||
) | ||
proposed_role = RoleFactory( | ||
group__type_id="wg", group__state_id="proposed", name_id="chair" | ||
) | ||
active_role = RoleFactory( | ||
group__type_id="wg", group__state_id="active", name_id="chair" | ||
) | ||
conclude_role = RoleFactory( | ||
group__type_id="wg", group__state_id="conclude", name_id="chair" | ||
) | ||
url = urlreverse( | ||
"ietf.group.views.group_leadership", kwargs={"group_type": "wg"} | ||
) | ||
r = self.client.get(url) | ||
self.assertEqual(r.status_code, 200) | ||
self.assertContains(r, "Group Leadership") | ||
self.assertContains(r, bof_role.person.last_name()) | ||
self.assertContains(r, proposed_role.person.last_name()) | ||
self.assertContains(r, active_role.person.last_name()) | ||
self.assertNotContains(r, conclude_role.person.last_name()) | ||
|
||
def test_leadership_wg_csv(self): | ||
url = urlreverse( | ||
"ietf.group.views.group_leadership_csv", kwargs={"group_type": "wg"} | ||
) | ||
r = self.client.get(url) | ||
self.assertEqual(r.status_code, 200) | ||
self.assertEqual(r["Content-Type"], "text/csv") | ||
self.assertContains(r, "Chairman, Sops") | ||
|
||
def test_leadership_rg(self): | ||
role = RoleFactory(group__type_id="rg", name_id="chair") | ||
url = urlreverse( | ||
"ietf.group.views.group_leadership", kwargs={"group_type": "rg"} | ||
) | ||
r = self.client.get(url) | ||
self.assertEqual(r.status_code, 200) | ||
self.assertContains(r, "Group Leadership") | ||
self.assertContains(r, role.person.last_name()) | ||
self.assertNotContains(r, "Chairman, Sops") | ||
|
||
|
||
class GroupStatsTests(TestCase): | ||
def setUp(self): | ||
super().setUp() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{% extends "base.html" %} | ||
{# Copyright The IETF Trust 2024, All Rights Reserved #} | ||
{% load origin static person_filters ietf_filters %} | ||
{% block pagehead %} | ||
<link rel="stylesheet" href="{% static 'ietf/css/list.css' %}"> | ||
{% endblock %} | ||
{% block title %}Group Leadership{% endblock %} | ||
{% block content %} | ||
{% origin %} | ||
<h1>Group Leadership ({{ group_type }})</h1> | ||
{% if user|has_role:"Secretariat" %} | ||
<div class="text-end"> | ||
<a class="btn btn-primary" href="{% url 'ietf.group.views.group_leadership_csv' group_type=group_type %}"> | ||
<i class="bi bi-file-ruled"></i> Export as CSV | ||
</a> | ||
</div> | ||
{% endif %} | ||
<table class="table table-sm table-striped"> | ||
<thead> | ||
<tr> | ||
<th scope="col">Leader</th> | ||
<th scope="col">Groups</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for leader in leaders %} | ||
<tr> | ||
<td>{{ leader.name }}</td> | ||
<td>{{ leader.groups }}</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
{% endblock %} |