Skip to content

Commit 0ed3d55

Browse files
committed
Add simple /doc/review-<foo> page for displaying a review, fix a
couple of bugs - Legacy-Id: 11362
1 parent 6a35431 commit 0ed3d55

3 files changed

Lines changed: 91 additions & 3 deletions

File tree

ietf/doc/views_doc.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,21 @@ def document_main(request, name, rev=None):
571571
),
572572
context_instance=RequestContext(request))
573573

574+
575+
if doc.type_id == "review":
576+
basename = "{}-{}.txt".format(doc.name, doc.rev)
577+
pathname = os.path.join(doc.get_file_path(), basename)
578+
content = get_document_content(basename, pathname, split=False)
579+
580+
return render(request, "doc/document_review.html",
581+
dict(doc=doc,
582+
top=top,
583+
content=content,
584+
revisions=revisions,
585+
latest_rev=latest_rev,
586+
snapshot=snapshot,
587+
))
588+
574589
raise Http404
575590

576591

ietf/doc/views_review.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ def complete_review(request, name, request_id):
390390

391391
review.type = DocTypeName.objects.get(slug="review")
392392
review.rev = "00"
393-
review.title = "Review of {}".format(review_req.doc.name)
393+
review.title = "Review of {}-{}".format(review_req.doc.name, review_req.reviewed_rev)
394394
review.group = review_req.team
395395
if review_submission == "link":
396396
review.external_url = form.cleaned_data['review_url']
@@ -402,9 +402,9 @@ def complete_review(request, name, request_id):
402402
type="new_revision",
403403
doc=review,
404404
by=request.user.person,
405-
rev=doc.rev,
405+
rev=review.rev,
406406
desc='New revision available',
407-
time=doc.time,
407+
time=review.time,
408408
)
409409

410410
# save file on disk
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{% extends "base.html" %}
2+
{# Copyright The IETF Trust 2016, All Rights Reserved #}
3+
{% load origin %}
4+
{% load staticfiles %}
5+
{% load ietf_filters %}
6+
7+
{% block title %}{{ doc.title }}{% endblock %}
8+
9+
{% block content %}
10+
{% origin %}
11+
{{ top|safe }}
12+
13+
{% include "doc/revisions_list.html" %}
14+
15+
<table class="table table-condensed">
16+
<thead id="message-row">
17+
<tr>
18+
{% if doc.rev != latest_rev %}
19+
<th colspan="3" class="alert-warning">The information below is for an old version of the document</th>
20+
{% else %}
21+
<th colspan="3"></th>
22+
{% endif %}
23+
</tr>
24+
</thead>
25+
26+
<tbody class="meta">
27+
<tr>
28+
<th class="col-md-1">Team</th>
29+
<td class="edit col-md-1"></td>
30+
<td class="col-md-10">
31+
{{ doc.group.name }}
32+
<a href="{{ doc.group.about_url }}">({{ doc.group.acronym }})</a>
33+
34+
{% if snapshot %}
35+
<span class="label label-warning">Snapshot</span>
36+
{% endif %}
37+
</td>
38+
</tr>
39+
40+
<tr>
41+
<th>Title</th>
42+
<td class="edit"></td>
43+
<td>{{ doc.title }}</td>
44+
</tr>
45+
46+
<tr>
47+
<th>State</th>
48+
<td class="edit"></td>
49+
<td>{{ doc.get_state.name }}</td>
50+
</tr>
51+
52+
{% if doc.external_url %}
53+
<tr>
54+
<th>Posted at</th>
55+
<td class="edit"></td>
56+
<td><a href="{{ doc.external_url }}">{{ doc.external_url }}</a></td>
57+
</tr>
58+
{% endif %}
59+
60+
<tr>
61+
<th>Last updated</th>
62+
<td class="edit"></td>
63+
<td>{{ doc.time|date:"Y-m-d" }}</td>
64+
</tr>
65+
</tbody>
66+
</table>
67+
68+
<h2>{{ doc.type.name }}<br><small>{{ doc.name }}</small></h2>
69+
70+
{% if doc.rev and content != None %}
71+
{{ content|fill:"80"|safe|linebreaksbr|keep_spacing|sanitize_html|safe }}
72+
{% endif %}
73+
{% endblock %}

0 commit comments

Comments
 (0)