Add a view of past meetings. Commit ready for merge.

- Legacy-Id: 12315
This commit is contained in:
Robert Sparks 2016-11-11 06:48:26 +00:00
parent f68d0c6f6b
commit e3c3b716cd
6 changed files with 176 additions and 2 deletions

View file

@ -672,6 +672,19 @@ class InterimTests(TestCase):
for session in meeting.session_set.all():
self.assertEqual(session.status.slug, 'scheda')
def test_past(self):
today = datetime.date.today()
last_week = today - datetime.timedelta(days=7)
ietf = SessionFactory(meeting__type_id='ietf',meeting__date=last_week,group__state_id='active',group__parent=GroupFactory(state_id='active'))
interim = SessionFactory(meeting__type_id='interim',meeting__date=last_week,status_id='canceled',group__state_id='active',group__parent=GroupFactory(state_id='active'))
url = urlreverse('ietf.meeting.views.past')
r = self.client.get(url)
self.assertEqual(r.status_code, 200)
self.assertTrue('IETF - %02d'%int(ietf.meeting.number) in unicontent(r))
q = PyQuery(r.content)
id="-%s" % interim.group.acronym
self.assertTrue('CANCELLED' in q('[id*="'+id+'"]').text())
def test_upcoming(self):
make_meeting_test_data()
url = urlreverse("ietf.meeting.views.upcoming")

View file

@ -95,6 +95,7 @@ urlpatterns = [
url(r'^interim/request/(?P<number>[A-Za-z0-9._+-]+)/cancel/?$', views.interim_request_cancel),
url(r'^interim/pending/?$', views.interim_pending),
url(r'^requests.html$', RedirectView.as_view(url='/meeting/requests', permanent=True)),
url(r'^past/?$', views.past),
url(r'^upcoming/?$', views.upcoming),
url(r'^upcoming.ics/?$', views.upcoming_ical),
# Then patterns from more specific to less

View file

@ -1883,6 +1883,36 @@ def interim_request_edit(request, number):
"form": form,
"formset": formset})
@cache_page(60*60)
def past(request):
'''List of past meetings'''
today = datetime.datetime.today()
meetings = Meeting.objects.filter(date__lte=today).exclude(
session__status__in=('apprw', 'scheda', 'canceledpa')).order_by('-date')
# extract groups hierarchy for display filter
seen = set()
groups = [m.session_set.first().group for m
in meetings.filter(type='interim')]
group_parents = []
for g in groups:
if g.parent.acronym not in seen:
group_parents.append(g.parent)
seen.add(g.parent.acronym)
seen = set()
for p in group_parents:
p.group_list = []
for g in groups:
if g.acronym not in seen and g.parent == p:
p.group_list.append(g)
seen.add(g.acronym)
p.group_list.sort(key=lambda g: g.acronym)
return render(request, 'meeting/past.html', {
'meetings': meetings,
'group_parents': group_parents})
def upcoming(request):
'''List of upcoming meetings'''

View file

@ -86,6 +86,7 @@
<li><a href="/meeting/">Materials</a></li>
<li><a href="https://www.ietf.org/meeting/proceedings.html">Past proceedings</a></li>
<li><a href="/meeting/upcoming">Upcoming</a></li>
<li><a href="/meeting/past">Past</a></li>
<li><a href="/secr/sreq/">Request a session</a></li>
<li><a href="/meeting/requests">Session requests</a></li>
{% if flavor == "top" %}</ul>{% endif %}

View file

@ -0,0 +1,129 @@
{% extends "base.html" %}
{# Copyright The IETF Trust 2015, All Rights Reserved #}
{% load origin %}
{% load ietf_filters staticfiles %}
{% block pagehead %}
<link rel="stylesheet" href="{% static "jquery.tablesorter/css/theme.bootstrap.min.css" %}">
{% endblock %}
{% block bodyAttrs %}data-spy="scroll" data-target="#affix"{% endblock %}
{% block title %}Past Meetings{% endblock %}
{% block content %}
{% origin %}
<div class="row">
<div class="col-md-10">
<h1>Past Meetings</h1>
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#customize">
<span class="fa fa-caret-down"></span> Customize the meeting list...
</a>
</h4>
</div> <!-- panel-heading -->
<div id="customize" class="panel-collapse collapse">
<div class="panel-body">
<p>
You can customize the list to show only selected groups
by clicking on groups and areas in the table below.
To be able to return to the customized view later, bookmark the resulting URL.
</p>
{% if group_parents|length %}
<p>Groups displayed in <b><i>italics</i></b> are BOFs.</p>
<table class="table table-condensed">
<thead>
<tr>
{% for p in group_parents %}
<th style="width:{% widthratio 1 group_parents|length 100 %}%">
<button class="btn btn-default btn-block pickview {{p.acronym|lower}}">{{p.acronym|upper}}</button>
</th>
{% endfor %}
</tr>
</thead>
<tbody>
<tr>
{% for p in group_parents %}
<td class="view {{p.acronym|lower}}">
<div class="btn-group-vertical btn-block">
{% for group in p.group_list %}
<div class="btn-group btn-group-xs btn-group-justified">
<button class="btn btn-default pickview {{group.acronym}}">
{% if group.is_bof %}
<i>{{group.acronym}}</i>
{% else %}
{{group.acronym}}
{% endif %}
</button>
</div> <!-- button-group -->
{% endfor %}
</div> <!-- button-group-vertical -->
</td>
{% endfor %}
</tr>
</tbody>
</table>
{% else %}
<blockquote><i>No past meetings are available.</i></blockquote>
{% endif %}
</div> <!-- panel-body -->
</div> <!-- panel-collapse -->
</div> <!-- panel -->
</div> <!-- panel-group -->
{% if meetings %}
<h3></h3>
<table class="table table-condensed table-striped tablesorter">
<thead>
<tr>
<th>Date</th>
<th>Group</th>
<th>Name</th>
</tr>
</thead>
<tbody>
{% for meeting in meetings %}
{% if meeting.type.slug == 'interim' %}
<tr id="row-{{ forloop.counter }}-{{ meeting.session_set.first.group.parent.acronym }}-{{ meeting.session_set.first.group.acronym }}">
{% else %}
<tr id="row-{{ forloop.counter }}-ietf">
{% endif %}
<td>{{ meeting.date }}</td>
{% if meeting.type.slug == 'interim' %}
<td>{{ meeting.session_set.all.0.group.acronym }}</td>
{% else %}
<td>ietf</td>
{% endif %}
<td>
{% if meeting.type.slug == "interim" %}
<a href="{% url 'ietf.meeting.views.session_details' num=meeting.number acronym=meeting.session_set.all.0.group.acronym %}">{{ meeting.number }}{% if meeting.session_set.all.0.status.slug == "canceled" %}&nbsp&nbsp<span class="label label-warning">CANCELLED</span>{% endif %}</a>
{% else %}
<a href="{% url 'ietf.meeting.views.agenda' num=meeting.number %}">IETF - {{ meeting.number }}</a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<h3>No past meetings</h3>
{% endif %}
</div>
</div>
{% endblock %}
{% block js %}
<script src="{% static "jquery.tablesorter/js/jquery.tablesorter.combined.min.js" %}"></script>
<script src="{% static 'ietf/js/toggle-visibility.js' %}"></script>
{% endblock %}

View file

@ -10,14 +10,14 @@
{% block bodyAttrs %}data-spy="scroll" data-target="#affix"{% endblock %}
{% block title %}Upcoming IETF Meetings{% endblock %}
{% block title %}Upcoming Meetings{% endblock %}
{% block content %}
{% origin %}
<div class="row">
<div class="col-md-10">
<h1>IETF Upcoming Meetings</h1>
<h1>Upcoming Meetings</h1>
<p>For more on regular IETF meetings see <a href="https://www.ietf.org/meeting/upcoming.html">here</a></p>
<div class="panel-group" id="accordion">