Skip to content

Commit d427303

Browse files
committed
Add IAB Administrative Support Group group type. Add IAB groups to the group menu. Clearly delineate group types in the group menu. Fixes ietf-tools#3295 and ietf-tools#3296. Commit ready for merge.
- Legacy-Id: 19307
1 parent 6a7ebfd commit d427303

8 files changed

Lines changed: 95 additions & 17 deletions

File tree

ietf/doc/templatetags/wg_menu.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,14 @@
3838

3939
register = template.Library()
4040

41-
area_short_names = {
41+
parent_short_names = {
4242
'ops':'Ops & Mgmt',
43-
'rai':'RAI'
43+
'rai':'RAI',
44+
'iab':'IAB',
4445
}
4546

4647
parents = Group.objects.filter(
47-
models.Q(type="area") | models.Q(type="irtf", acronym="irtf"),
48+
models.Q(type="area") | models.Q(type="irtf", acronym="irtf") | models.Q(acronym='iab'),
4849
state="active"
4950
).order_by('type_id', 'acronym')
5051

@@ -53,13 +54,15 @@ def wg_menu():
5354
global parents
5455

5556
for p in parents:
56-
p.short_name = area_short_names.get(p.acronym) or p.name
57+
p.short_name = parent_short_names.get(p.acronym) or p.name
5758
if p.short_name.endswith(" Area"):
5859
p.short_name = p.short_name[:-len(" Area")]
5960

6061
if p.type_id == "area":
6162
p.menu_url = "/wg/#" + p.acronym
6263
elif p.acronym == "irtf":
6364
p.menu_url = "/rg/"
65+
elif p.acronym == "iab":
66+
p.menu_url = "/program/"
6467

6568
return render_to_string('base/menu_wg.html', { 'parents': parents })
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright The IETF Trust 2021 All Rights Reserved
2+
3+
from django.db import migrations
4+
5+
def forward(apps, schema_editor):
6+
GroupFeatures = apps.get_model('group', 'GroupFeatures')
7+
Group = apps.get_model('group', 'Group')
8+
9+
# Copy program to iabasg
10+
feat = GroupFeatures.objects.get(pk='program')
11+
feat.pk = 'iabasg'
12+
feat.save()
13+
feat.parent_types.add('ietf')
14+
15+
# List provided by Cindy on 30Aug2021
16+
Group.objects.filter(acronym__in=['iana-evolution','iproc','liaison-oversight','ietfiana','plenary-planning','rfcedprog']).update(type_id='iabasg')
17+
18+
Group.objects.filter(acronym='model-t').update(parent=Group.objects.get(acronym='iab'))
19+
20+
def reverse(apps, schema_editor):
21+
GroupFeatures = apps.get_model('group', 'GroupFeatures')
22+
Group = apps.get_model('group', 'Group')
23+
Group.objects.filter(type_id='iabasg').update(type_id='program')
24+
# Intentionally not removing the parent of model-t
25+
GroupFeatures.objects.filter(pk='iabasg').delete()
26+
27+
28+
29+
class Migration(migrations.Migration):
30+
31+
dependencies = [
32+
('group', '0044_populate_groupfeatures_parent_type_fields'),
33+
('name', '0028_iabasg'),
34+
]
35+
36+
operations = [
37+
migrations.RunPython(forward, reverse)
38+
]

ietf/group/views.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@ def active_groups(request, group_type=None):
292292
return active_dirs(request)
293293
elif group_type == "review":
294294
return active_review_dirs(request)
295-
elif group_type == "program":
296-
return active_programs(request)
295+
elif group_type in ("program", "iabasg"):
296+
return active_iab(request)
297297
else:
298298
raise Http404
299299

@@ -321,11 +321,11 @@ def active_teams(request):
321321
group.chairs = sorted(roles(group, "chair"), key=extract_last_name)
322322
return render(request, 'group/active_teams.html', {'teams' : teams })
323323

324-
def active_programs(request):
325-
programs = Group.objects.filter(type="program", state="active").order_by("name")
326-
for group in programs:
324+
def active_iab(request):
325+
iabgroups = Group.objects.filter(type__in=("program","iabasg"), state="active").order_by("-type_id","name")
326+
for group in iabgroups:
327327
group.leads = sorted(roles(group, "lead"), key=extract_last_name)
328-
return render(request, 'group/active_programs.html', {'programs' : programs })
328+
return render(request, 'group/active_iabgroups.html', {'iabgroups' : iabgroups })
329329

330330
def active_areas(request):
331331
areas = Group.objects.filter(type="area", state="active").order_by("name")
@@ -1290,12 +1290,13 @@ def group_json(request, acronym):
12901290
@cache_control(public=True, max_age=30*60)
12911291
@cache_page(30 * 60)
12921292
def group_menu_data(request):
1293-
groups = Group.objects.filter(state="active", type__features__acts_like_wg=True, parent__state="active").order_by("acronym")
1293+
groups = Group.objects.filter(state="active", parent__state="active").filter(Q(type__features__acts_like_wg=True)|Q(type_id__in=['program','iabasg'])).order_by("-type_id","acronym")
12941294

12951295
groups_by_parent = defaultdict(list)
12961296
for g in groups:
12971297
url = urlreverse("ietf.group.views.group_home", kwargs={ 'group_type': g.type_id, 'acronym': g.acronym })
1298-
groups_by_parent[g.parent_id].append({ 'acronym': g.acronym, 'name': escape(g.name), 'url': url })
1298+
# groups_by_parent[g.parent_id].append({ 'acronym': g.acronym, 'name': escape(g.name), 'url': url })
1299+
groups_by_parent[g.parent_id].append({ 'acronym': g.acronym, 'name': escape(g.name), 'type': escape(g.type.verbose_name or g.type.name), 'url': url })
12991300

13001301
return JsonResponse(groups_by_parent)
13011302

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright The IETF Trust 2021 All Rights Reserved
2+
3+
from django.db import migrations
4+
5+
def forward(apps, schema_editor):
6+
GroupTypeName = apps.get_model('name', 'GroupTypeName')
7+
GroupTypeName.objects.create(slug='iabasg', name='IAB ASG', verbose_name='IAB Administrative Support Group', desc='')
8+
9+
def reverse(apps, schema_editor):
10+
GroupTypeName = apps.get_model('name', 'GroupTypeName')
11+
GroupTypeName.objects.filter(slug='iabasg').delete()
12+
13+
14+
class Migration(migrations.Migration):
15+
16+
dependencies = [
17+
('name', '0027_add_bofrequest'),
18+
]
19+
20+
operations = [
21+
migrations.RunPython(forward, reverse)
22+
]

ietf/static/ietf/css/ietf.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ body { padding-top: 72px; }
3737
.dropdown-submenu > .dropdown-menu li a{
3838
line-height: 1.2;
3939
}
40+
.dropdown-submenu > .dropdown-menu li.separator{
41+
font-size: 80%;
42+
margin-left: 1em;
43+
padding: .5em 0;
44+
border-bottom: 1px solid #CCC;
45+
}
4046
.dropdown-submenu > a:after {
4147
display: block;
4248
content: " ";

ietf/static/ietf/js/ietf.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,13 @@ $(document).ready(function () {
224224
var menu = ['<ul class="dropdown-menu" role="menu">'];
225225

226226
var groups = data[parentId];
227+
var gtype = ""
227228
for (var i = 0; i < groups.length; ++i) {
228229
var g = groups[i];
230+
if (g.type != gtype) {
231+
menu.push('<li class="separator">' + g.type + 's</li>')
232+
gtype = g.type
233+
}
229234
menu.push('<li><a href="' + g.url + '">' + g.acronym +' &mdash; ' + g.name + '</a></li>');
230235
}
231236

ietf/templates/group/active_programs.html renamed to ietf/templates/group/active_iabgroups.html

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,24 @@
66
<link rel="stylesheet" href="{% static "jquery.tablesorter/css/theme.bootstrap.min.css" %}">
77
{% endblock %}
88

9-
{% block title %}Active programs{% endblock %}
9+
{% block title %}Active IAB groups{% endblock %}
1010

1111

1212
{% block content %}
1313
{% origin %}
14-
<h1>Active programs</h1>
14+
{% regroup iabgroups by type as grouped_groups %}
15+
{% for grouptype in grouped_groups %}
16+
<h1>Active {% firstof grouptype.grouper.verbose_name grouptype.grouper.name %}{{grouptype.list|pluralize}}</h1>
1517
<table class="table table-condensed table-striped tablesorter">
1618
<thead>
1719
<tr>
18-
<th>Program</th>
20+
<th>{{grouptype.grouper}}</th>
1921
<th>Name</th>
2022
<th>Lead</th>
2123
</tr>
2224
</thead>
2325
<tbody>
24-
{% for group in programs %}
26+
{% for group in grouptype.list %}
2527
<tr>
2628
<td><a href="{% url "ietf.group.views.group_home" acronym=group.acronym %}">{{ group.acronym }}</a></td>
2729
<td>{{ group.name }}</td>
@@ -34,6 +36,7 @@ <h1>Active programs</h1>
3436
{% endfor %}
3537
</tbody>
3638
</table>
39+
{% endfor %}
3740

3841
{% endblock %}
3942

ietf/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
url(r'^submit/', include('ietf.submit.urls')),
6767
url(r'^sync/', include('ietf.sync.urls')),
6868
url(r'^templates/', include('ietf.dbtemplate.urls')),
69-
url(r'^(?P<group_type>(wg|rg|ag|rag|team|dir|review|area|program|adhoc|ise))/', include(grouptype_urls)),
69+
url(r'^(?P<group_type>(wg|rg|ag|rag|team|dir|review|area|program|iabasg|adhoc|ise))/', include(grouptype_urls)),
7070

7171
# Redirects
7272
url(r'^(?P<path>public)/', include('ietf.redirects.urls')),

0 commit comments

Comments
 (0)