Provided navigation for managing materials from the group meeting and meeting session views

- Legacy-Id: 10760
This commit is contained in:
Robert Sparks 2016-02-01 19:39:10 +00:00
parent 0db79011f2
commit a91ab77dbc
2 changed files with 45 additions and 17 deletions

View file

@ -6,7 +6,7 @@ import re
import tarfile
import urllib
from tempfile import mkstemp
from collections import OrderedDict
from collections import OrderedDict, Counter
import csv
import json
@ -25,6 +25,7 @@ from django.views.decorators.csrf import ensure_csrf_cookie
from ietf.doc.models import Document, State
from ietf.group.models import Group
from ietf.group.utils import can_manage_materials
from ietf.ietfauth.utils import role_required, has_role
from ietf.meeting.models import Meeting, Session, Schedule, Room
from ietf.meeting.helpers import get_areas, get_person_by_email, get_schedule_by_name
@ -844,21 +845,32 @@ def session_details(request, num, acronym ):
if not sessions:
raise Http404
type_counter = Counter()
for session in sessions:
ss = session.timeslotassignments.filter(schedule=meeting.agenda).order_by('timeslot__time')
if ss:
session.time = ', '.join(x.timeslot.time.strftime("%A %b-%d-%Y %H%M") for x in ss)
if session.status.slug == 'canceled':
session.time += " CANCELLED"
elif session.meeting.type_id=='interim':
session.time = session.meeting.date.strftime("%A %b-%d-%Y")
if session.status.slug == 'canceled':
session.time += " CANCELLED"
else:
session.time = 'Not yet scheduled'
session.time = session.status.name
# TODO FIXME Deleted materials shouldn't be in the sessionpresentation_set
session.filtered_sessionpresentation_set = [p for p in session.sessionpresentation_set.all() if p.document.get_state_slug(p.document.type_id)!='deleted']
type_counter.update([p.document.type.slug for p in session.filtered_sessionpresentation_set])
can_manage = can_manage_materials(request.user, Group.objects.get(acronym=acronym))
return render(request, "meeting/session_details.html",
{ 'sessions':sessions ,
'meeting' :meeting ,
'acronym' :acronym,
'can_manage_materials' : can_manage,
'type_counter': type_counter,
})

View file

@ -9,23 +9,39 @@
<h1>{{ meeting }} : {{ acronym }}</h1>
{% for session in sessions %}
<h2>{{ session.time }}{% if session.name %} : {{ session.name }}{% endif %}</h2>
<h2>{% if sessions|length > 1 %}Session {{ forloop.counter }} : {% endif %}{{ session.time }}{% if session.name %} : {{ session.name }}{% endif %}</h2>
{% if can_manage_materials %}
{% if session.status.slug == 'sched' or session.status.slug == 'schedw' %}
<div class="buttonlist">
<a class="btn btn-default" href="{% url 'ietf.secr.proceedings.views.upload_unified' meeting_num=session.meeting.number acronym=session.group.acronym %}">
Upload/Edit Materials
</a>
{% if not type_counter.agenda %}
<span class="label label-warning">This session does not yet have an agenda</span>
{% endif %}
</div>
{% endif %}
{% endif %}
{% if session.filtered_sessionpresentation_set %}
<p>Materials:</p>
<table class="table table-condensed table-striped">
{% for pres in session.filtered_sessionpresentation_set %}
{% if pres.document.type_id != 'bluesheets' and pres.document.type_id != 'recording' %}
<tr>
<td>
<a href="{% url 'doc_view' name=pres.document.name rev=pres.rev%}">{{pres.document.title}} ({{ pres.document.name }}-{{ pres.rev }})
</a>
</td>
</tr>
{% endif %}
{% endfor %}
</table>
<div class="panel panel-default">
<div class="panel-heading">Materials:</div>
<div class="panel-body">
<table class="table table-condensed table-striped">
{% for pres in session.filtered_sessionpresentation_set %}
{% if pres.document.type_id != 'bluesheets' and pres.document.type_id != 'recording' %}
<tr>
<td>
<a href="{% url 'doc_view' name=pres.document.name rev=pres.rev%}">{{pres.document.title}} ({{ pres.document.name }}-{{ pres.rev }})
</a>
</td>
</tr>
{% endif %}
{% endfor %}
</table>
</div>
</div>
{% endif %}
{% endfor %}