Skip to content

Commit 43e9ea2

Browse files
committed
Unify history handling for groups and documents.
- Legacy-Id: 4149
1 parent a63edc9 commit 43e9ea2

5 files changed

Lines changed: 9 additions & 27 deletions

File tree

ietf/idrfc/views_doc.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
from ietf.idrfc.models import RfcIndex, DraftVersions
5151
from ietf.idrfc.idrfc_wrapper import BallotWrapper, IdWrapper, RfcWrapper
5252
from ietf.ietfworkflows.utils import get_full_info_for_draft
53-
from ietf.doc.models import Document, DocEvent, NewRevisionDocEvent, WriteupDocEvent
53+
from ietf.doc.models import Document, DocEvent, NewRevisionDocEvent, WriteupDocEvent, TelechatDocEvent
5454
from ietf.doc.utils import get_chartering_type
5555
from ietf.utils.history import find_history_active_at
5656
from ietf.ietfauth.decorators import has_role
@@ -121,17 +121,11 @@ def document_main(request, name, rev=None):
121121

122122

123123
if doc.type_id == "charter":
124-
# FIXME: add editing of charters/telechat date
125-
# FIXME: check sanity of edit buttons "Recharter"
126-
# FIXME: clean up wgcharter code redundant with this
127-
128124
filename = doc.name + "-" + doc.rev + ".txt"
129125

130126
content = _get_html(filename, os.path.join(settings.CHARTER_PATH, filename), split=False)
131127

132-
telechat = None
133-
if not snapshot:
134-
telechat = doc.latest_event(type="scheduled_for_telechat")
128+
telechat = doc.latest_event(TelechatDocEvent, type="scheduled_for_telechat")
135129

136130
return render_to_response("idrfc/document_charter.html",
137131
dict(doc=doc,
@@ -202,12 +196,6 @@ def document_history(request, name):
202196

203197
e.rev = cur_rev
204198

205-
# add snippets
206-
for e in events:
207-
e.desc_snippet = truncatewords_html(format_textarea(fill(e.desc, 80)), 3)
208-
if not e.desc_snippet.endswith("..."):
209-
e.desc_snippet = None
210-
211199
return render_to_response("idrfc/document_history.html",
212200
dict(doc=doc,
213201
top=top,

ietf/idtracker/templatetags/ietf_filters.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -445,9 +445,9 @@ def ad_area(user):
445445
def format_history_text(text):
446446
"""Run history text through some cleaning and add ellipsis if it's too long."""
447447
full = mark_safe(sanitize_html(keep_spacing(linebreaksbr(urlize(mark_safe(text))))))
448-
snipped = truncatewords_html(format_textarea(fill(text, 80)), 25)
449-
if snipped[-3:] == "...":
450-
return mark_safe(u'<div class="snipped">%s<div class="showAll">[show all]</div><div><div style="display:none" class="full">%s</div>' % (snipped, full))
448+
snippet = truncatewords_html(format_textarea(fill(text, 80)), 25)
449+
if snippet[-3:] == "...":
450+
return mark_safe(u'<div class="snippet">%s<span class="showAll">[show all]</span></div><div style="display:none" class="full">%s</div>' % (snippet, full))
451451
return full
452452

453453
@register.filter

ietf/templates/idrfc/document_history.html

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,21 +68,13 @@ <h2>Document history</h2>
6868
<td>{{ e.time|date:"Y-m-d" }}</td>
6969
<td>{{ e.rev }}</td>
7070
<td>{{ e.by|escape }}</td>
71-
<td>{% if e.desc_snippet %}
72-
<div class="snippet">{{ e.desc_snippet|safe }} <span class="showAll">[show all]</span></div>
73-
<div class="full" style="display:none;">
74-
{{ e.desc|fill:"80"|safe|urlize|linebreaksbr|keep_spacing|sanitize_html|safe }}
75-
</div>
76-
{% else %}
77-
{{ e.desc|fill:"80"|safe|urlize|linebreaksbr|keep_spacing|sanitize_html|safe }}
78-
{% endif %}
71+
<td>{{ e.desc|format_history_text }}
7972
</td>
8073
</tr>
8174
{% endfor %}
82-
8375
</table>
8476
{% endblock content %}
8577

8678
{% block content_end %}
87-
<script type="text/javascript" src="/js/doc-history.js"></script>
79+
<script type="text/javascript" src="/js/history.js"></script>
8880
{% endblock content_end %}

static/css/base2.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ table.ballot_icon td.ballot_icon_my { border: 3px outset black;}
133133
.ietf-highlight-r { padding:0 2px;background:#ffa0a0;}
134134
.ietf-divider { background: #2647a0; color: white; font-size:116%; padding:0.5em 1em; }
135135

136+
table.history .snippet .showAll { color: blue; cursor: pointer; }
137+
136138
.error-text {
137139
font-size: 1.095em;
138140
width: 48em;

0 commit comments

Comments
 (0)