Skip to content

Commit f63a99b

Browse files
committed
Facelift remaining materials pages
- Legacy-Id: 8938
1 parent 88c9f84 commit f63a99b

6 files changed

Lines changed: 92 additions & 120 deletions

File tree

ietf/doc/views_material.py

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -270,24 +270,23 @@ def edit_material_presentations(request, name, acronym=None, date=None, seq=None
270270
if request.method == 'POST':
271271
form = MaterialVersionForm(request.POST,choices=choices)
272272
if form.is_valid():
273-
if request.POST.get("action", "") == "Save":
274-
new_selection = form.cleaned_data['version']
275-
if initial['version'] != new_selection:
276-
if initial['version'] == 'notpresented':
277-
doc.sessionpresentation_set.create(session=session,rev=new_selection)
278-
c = DocEvent(type="added_comment", doc=doc, by=request.user.person)
279-
c.desc = "Added version %s to session: %s" % (new_selection,session)
280-
c.save()
281-
elif new_selection == 'notpresented':
282-
doc.sessionpresentation_set.filter(session=session).delete()
283-
c = DocEvent(type="added_comment", doc=doc, by=request.user.person)
284-
c.desc = "Removed from session: %s" % (session)
285-
c.save()
286-
else:
287-
doc.sessionpresentation_set.filter(session=session).update(rev=new_selection)
288-
c = DocEvent(type="added_comment", doc=doc, by=request.user.person)
289-
c.desc = "Revision for session %s changed to %s" % (session,new_selection)
290-
c.save()
273+
new_selection = form.cleaned_data['version']
274+
if initial['version'] != new_selection:
275+
if initial['version'] == 'notpresented':
276+
doc.sessionpresentation_set.create(session=session,rev=new_selection)
277+
c = DocEvent(type="added_comment", doc=doc, by=request.user.person)
278+
c.desc = "Added version %s to session: %s" % (new_selection,session)
279+
c.save()
280+
elif new_selection == 'notpresented':
281+
doc.sessionpresentation_set.filter(session=session).delete()
282+
c = DocEvent(type="added_comment", doc=doc, by=request.user.person)
283+
c.desc = "Removed from session: %s" % (session)
284+
c.save()
285+
else:
286+
doc.sessionpresentation_set.filter(session=session).update(rev=new_selection)
287+
c = DocEvent(type="added_comment", doc=doc, by=request.user.person)
288+
c.desc = "Revision for session %s changed to %s" % (session,new_selection)
289+
c.save()
291290
return redirect('doc_view',name=doc.name)
292291
else:
293292
form = MaterialVersionForm(choices=choices,initial=initial)
Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
1-
{% extends "base.html" %}
1+
{% extends "ietf.html" %}
22

3-
{% block title %}Upload Material for Group {{ group.acronym }}{% endblock %}
4-
5-
{% block morecss %}
6-
{{ block.super }}
7-
.material-types li { margin-bottom: 0.5em; }
8-
{% endblock %}
9-
10-
{% block content %}
113
{% load ietf_filters %}
124

13-
<h1>Upload Material for Group {{ group.acronym }}</h1>
5+
{% block title %}Upload Material for group {{ group.name }} ({{ group.acronym }}){% endblock %}
146

15-
<p>Select what kind of material you wish to upload:</p>
7+
{% block content %}
8+
<h1>Upload Material<br><small>{{ group.name }} ({{ group.acronym }})</small></h1>
169

17-
<ul class="material-types">
18-
{% for t in material_types %}
19-
<li><a href="{% url "group_new_material" acronym=group.acronym doc_type=t.slug %}">{{ t.name }}</a></li>
20-
{% endfor %}
21-
</ul>
10+
<p>Select what kind of material you wish to upload:</p>
2211

12+
<ul class="material-types">
13+
{% for t in material_types %}
14+
<li><a href="{% url "group_new_material" acronym=group.acronym doc_type=t.slug %}">{{ t.name }}</a></li>
15+
{% endfor %}
16+
</ul>
2317
{% endblock content %}

ietf/templates/doc/material/edit_material.html

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,39 @@
1-
{% extends "base.html" %}
1+
{% extends "ietf.html" %}
22

3-
{% block title %}{% if action == "new" or action == "revise" %}Upload{% else %}Edit{% endif %} {{ document_type.name }} for Group {{ group.acronym }}{% endblock %}
3+
{% load bootstrap3 %}
44

5-
{% block morecss %}
6-
{{ block.super }}
7-
form.upload-material td { padding-bottom: 0.6em; }
8-
form.upload-material #id_title, form.upload-material #id_name, form.upload-material #id_abstract { width: 30em; }
9-
form.upload-material .submit-row td { padding-top: 1em; text-align: right; }
10-
{% endblock %}
5+
{% block title %}{% if action == "new" or action == "revise" %}Upload{% else %}Edit{% endif %} {{ document_type.name }} for group {{ group.name }} ({{ group.acronym }}){% endblock %}
116

127
{% block content %}
13-
{% load ietf_filters %}
148

15-
<h1>{% if action == "new" or action == "revise" %}Upload{% else %}Edit{% endif %} {{ document_type.name }} for Group {{ group.acronym }}</h1>
9+
<h1>{% if action == "new" or action == "revise" %}Upload{% else %}Edit{% endif %} {{ document_type.name }}<br><small>{{ group.name }} ({{ group.acronym }})</small></h1>
1610

1711
{% if action == "new" %}
18-
<p>
19-
Below you can upload a file for the group
20-
<a href="{% url "group_materials" acronym=group.acronym %}">{{ group.acronym }}</a>.
21-
The file will appear under the materials tab in the group pages.
12+
<p class="help-block">
13+
Below you can upload a document for the group {{ group.name }}
14+
<a href="{% url "group_materials" acronym=group.acronym %}">({{ group.acronym }})</a>.
15+
The document will appear under the materials tab in the group pages.
2216
</p>
2317

24-
<h3>Upload</h3>
18+
<h2>Upload</h2>
2519
{% elif action == "revise" %}
2620
<p>
27-
Below you can upload a new revision of {{ doc_name }} for the group
28-
<a href="{% url "group_materials" acronym=group.acronym %}">{{ group.acronym }}</a>.
21+
Below you can upload a new revision of {{ doc_name }} for the group {{ group.name }}
22+
<a href="{% url "group_materials" acronym=group.acronym %}">({{ group.acronym }})</a>.
2923
</p>
3024

31-
<h3>Upload New Revision</h3>
25+
<h2>Upload New Revision</h2>
3226
{% endif %}
3327

34-
<form class="upload-material" method="post" enctype="multipart/form-data" data-nameprefix="{{ document_type.slug }}-{{ group.acronym }}-">{% csrf_token %}
35-
<table>
36-
{{ form.as_table }}
37-
38-
<tr class="submit-row">
39-
<td colspan="2">
40-
<a class="button" href="{% if doc_name %}{% url "doc_view" name=doc_name %}{% else %}{% url "group_materials" acronym=group.acronym %}{% endif %}">Cancel</a>
41-
<input class="submit button" type="submit" value="{% if action == "new" or action == "revise" %}Upload{% else %}Save{% endif %}" />
42-
</td>
43-
</tr>
44-
</table>
28+
<form class="upload-material" role="form" method="post" enctype="multipart/form-data" data-nameprefix="{{ document_type.slug }}-{{ group.acronym }}-">
29+
{% csrf_token %}
30+
31+
{% bootstrap_form form %}
32+
33+
{% buttons %}
34+
<a class="btn btn-default pull-right" href="{% if doc_name %}{% url "doc_view" name=doc_name %}{% else %}{% url "group_materials" acronym=group.acronym %}{% endif %}">Back</a>
35+
<button class="btn btn-primary" type="submit">{% if action == "new" or action == "revise" %}Upload{% else %}Save{% endif %}</button>
36+
{% endbuttons %}
4537
</form>
4638

4739
{% endblock content %}
Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
1-
{% extends "base.html" %}
1+
{% extends "ietf.html" %}
22

3-
{% block title %}
4-
Edit Upcoming Presentations
5-
{% endblock %}
3+
{% load bootstrap3 %}
64

7-
{% block morecss %}
8-
{{ block.super }}
9-
ul#id_versions { list-style-type: none; padding: 0px; margin: 0px; }
10-
{% endblock %}
5+
{% block title %}Edit Upcoming Presentations{% endblock %}
116

127
{% block content %}
13-
{% load ietf_filters %}
8+
<h1>Edit Upcoming Presentations<br><small>{{doc.title}}<br>{{doc.name}}<br>at {{session}}</small></h1>
149

15-
<h1>Edit Upcoming Presentations of<br/>{{doc.title}}<br/>{{doc.name}}<br/>at {{session}}</h1>
10+
<form role="form" method="post">
11+
{% csrf_token %}
1612

17-
<form method="post">{% csrf_token %}
18-
{{form.as_p}}
19-
<input style="button" type="submit" name="action" value="Save"/>
20-
<input style="button" type="submit" name="action" value="Cancel"/>
21-
</form>
13+
{% bootstrap_form form %}
2214

15+
{% buttons %}
16+
<a class="btn btn-default pull-right" href="{% url "doc_view" name=doc.name %}">Back</a>
17+
<button class="btn btn-primary" type="submit">Save</button>
18+
{% endbuttons %}
19+
</form>
2320
{% endblock content %}
Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,32 @@
1-
{% extends "base.html" %}
1+
{% extends "ietf.html" %}
22

3-
{% block title %}
4-
Upcoming Presentations
5-
{% endblock %}
3+
{% block title %}Upcoming Presentations{% endblock %}
64

75
{% block content %}
8-
{% load ietf_filters %}
9-
10-
<h1>Upcoming Presentations of<br/>{{doc.title}}<br/>{{doc.name}}</h1>
11-
12-
<ul>
13-
{% regroup sessions by has_presentation as is_scheduled_list %}
14-
{% for is_scheduled in is_scheduled_list %}
15-
<li> {{ is_scheduled.grouper|yesno:"Presentation Scheduled,Presentation Not Scheduled"}}
16-
<ul>
17-
{% regroup is_scheduled.list by group as group_list %}
18-
{% for group in group_list %}
19-
{% for session in group.list %}
20-
<li>
21-
{% if week_day %}
22-
<a href="{% url 'ietf.doc.views_material.edit_material_presentations' name=doc.name acronym=group.grouper.acronym seq=forloop.counter week_day=week_day %}">{{ session }}</a>
23-
{% elif date %}
24-
<a href="{% url 'ietf.doc.views_material.edit_material_presentations' name=doc.name acronym=group.grouper.acronym seq=forloop.counter date=date %}">{{ session }}</a>
25-
{% else %}
26-
<a href="{% url 'ietf.doc.views_material.edit_material_presentations' name=doc.name acronym=group.grouper.acronym seq=forloop.counter %}">{{ session }}</a>
27-
{% endif %}
28-
{% if session.versions %} (version{{session.versions|pluralize}} {{session.versions|join:','}}) {% endif %}
29-
</li>
30-
{% endfor %}
31-
{% endfor %}
32-
</ul>
33-
</li>
34-
{% endfor %}
35-
</ul>
6+
<h1>Upcoming Presentations<br><small>{{doc.title}}<br>{{doc.name}}</small></h1>
367

8+
<ul>
9+
{% regroup sessions by has_presentation as is_scheduled_list %}
10+
{% for is_scheduled in is_scheduled_list %}
11+
<li> {{ is_scheduled.grouper|yesno:"Presentation Scheduled,Presentation Not Scheduled"}}
12+
<ul>
13+
{% regroup is_scheduled.list by group as group_list %}
14+
{% for group in group_list %}
15+
{% for session in group.list %}
16+
<li>
17+
{% if week_day %}
18+
<a href="{% url 'ietf.doc.views_material.edit_material_presentations' name=doc.name acronym=group.grouper.acronym seq=forloop.counter week_day=week_day %}">{{ session }}</a>
19+
{% elif date %}
20+
<a href="{% url 'ietf.doc.views_material.edit_material_presentations' name=doc.name acronym=group.grouper.acronym seq=forloop.counter date=date %}">{{ session }}</a>
21+
{% else %}
22+
<a href="{% url 'ietf.doc.views_material.edit_material_presentations' name=doc.name acronym=group.grouper.acronym seq=forloop.counter %}">{{ session }}</a>
23+
{% endif %}
24+
{% if session.versions %} (version{{session.versions|pluralize}} {{session.versions|join:','}}) {% endif %}
25+
</li>
26+
{% endfor %}
27+
{% endfor %}
28+
</ul>
29+
</li>
30+
{% endfor %}
31+
</ul>
3732
{% endblock content %}

ietf/templates/group/materials.html

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{% extends "group/group_base.html" %}
2+
23
{% load ietf_filters %}
34

45
{% block group_subtitle %}Materials{% endblock %}
56

67
{% block morecss %}
78
{{ block.super }}
8-
.materials .edit-options { float: right; margin-left: 2em; font-style: italic; }
99
.materials .snippable { width:25em; }
1010
{% endblock %}
1111

@@ -16,8 +16,7 @@
1616
{% for doc_type, docs in doc_types %}
1717
<h2>{{ doc_type.name }}</h2>
1818

19-
<table class="ietf-table ietf-doctable materials">
20-
19+
<table class="table table-condensed table-striped materials">
2120
<tr>
2221
<th>Title</th>
2322
<th>Abstract</th>
@@ -28,7 +27,7 @@ <h2>{{ doc_type.name }}</h2>
2827
</tr>
2928

3029
{% for d in docs %}
31-
<tr class="{% cycle "evenrow" "oddrow" %}">
30+
<tr>
3231
<td><a class="title-link" href="{% url "doc_view" name=d.name %}">{{ d.title }}</a></td>
3332
<td class='snippable'>{{ d.abstract|format_snippet }} </td>
3433
<td>{{ d.rev }}</td>
@@ -37,7 +36,7 @@ <h2>{{ doc_type.name }}</h2>
3736
{% for p in past_pres_list %}
3837
{{ p.grouper }}
3938
{% if p.list|length > 1 %}
40-
( {{ p.list|length }} sessions )
39+
({{ p.list|length }} sessions)
4140
{% else %}
4241
{% for pr in p.list %}
4342
{% if pr.rev != d.rev %}
@@ -51,7 +50,7 @@ <h2>{{ doc_type.name }}</h2>
5150
{% for p in meeting_pres_list %}
5251
{{ p.grouper }}
5352
{% if p.list|length > 1 %}
54-
( {{ p.list|length }} sessions )
53+
({{ p.list|length }} sessions)
5554
{% else %}
5655
{% for pr in p.list %}
5756
{% if pr.rev != d.rev %}
@@ -73,7 +72,3 @@ <h2>Materials</h2>
7372
{% endif %}
7473

7574
{% endblock %}
76-
77-
{% block content_end %}
78-
<script src="/js/snippet.js" type="text/javascript"></script>
79-
{% endblock %}

0 commit comments

Comments
 (0)