Unify history handling for groups and documents.

- Legacy-Id: 4149
This commit is contained in:
Ole Laursen 2012-03-20 18:22:14 +00:00
parent a63edc9d16
commit 43e9ea2607
5 changed files with 9 additions and 27 deletions

View file

@ -50,7 +50,7 @@ from ietf.idrfc import markup_txt
from ietf.idrfc.models import RfcIndex, DraftVersions
from ietf.idrfc.idrfc_wrapper import BallotWrapper, IdWrapper, RfcWrapper
from ietf.ietfworkflows.utils import get_full_info_for_draft
from ietf.doc.models import Document, DocEvent, NewRevisionDocEvent, WriteupDocEvent
from ietf.doc.models import Document, DocEvent, NewRevisionDocEvent, WriteupDocEvent, TelechatDocEvent
from ietf.doc.utils import get_chartering_type
from ietf.utils.history import find_history_active_at
from ietf.ietfauth.decorators import has_role
@ -121,17 +121,11 @@ def document_main(request, name, rev=None):
if doc.type_id == "charter":
# FIXME: add editing of charters/telechat date
# FIXME: check sanity of edit buttons "Recharter"
# FIXME: clean up wgcharter code redundant with this
filename = doc.name + "-" + doc.rev + ".txt"
content = _get_html(filename, os.path.join(settings.CHARTER_PATH, filename), split=False)
telechat = None
if not snapshot:
telechat = doc.latest_event(type="scheduled_for_telechat")
telechat = doc.latest_event(TelechatDocEvent, type="scheduled_for_telechat")
return render_to_response("idrfc/document_charter.html",
dict(doc=doc,
@ -202,12 +196,6 @@ def document_history(request, name):
e.rev = cur_rev
# add snippets
for e in events:
e.desc_snippet = truncatewords_html(format_textarea(fill(e.desc, 80)), 3)
if not e.desc_snippet.endswith("..."):
e.desc_snippet = None
return render_to_response("idrfc/document_history.html",
dict(doc=doc,
top=top,

View file

@ -445,9 +445,9 @@ def ad_area(user):
def format_history_text(text):
"""Run history text through some cleaning and add ellipsis if it's too long."""
full = mark_safe(sanitize_html(keep_spacing(linebreaksbr(urlize(mark_safe(text))))))
snipped = truncatewords_html(format_textarea(fill(text, 80)), 25)
if snipped[-3:] == "...":
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))
snippet = truncatewords_html(format_textarea(fill(text, 80)), 25)
if snippet[-3:] == "...":
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))
return full
@register.filter

View file

@ -68,21 +68,13 @@
<td>{{ e.time|date:"Y-m-d" }}</td>
<td>{{ e.rev }}</td>
<td>{{ e.by|escape }}</td>
<td>{% if e.desc_snippet %}
<div class="snippet">{{ e.desc_snippet|safe }} <span class="showAll">[show all]</span></div>
<div class="full" style="display:none;">
{{ e.desc|fill:"80"|safe|urlize|linebreaksbr|keep_spacing|sanitize_html|safe }}
</div>
{% else %}
{{ e.desc|fill:"80"|safe|urlize|linebreaksbr|keep_spacing|sanitize_html|safe }}
{% endif %}
<td>{{ e.desc|format_history_text }}
</td>
</tr>
{% endfor %}
</table>
{% endblock content %}
{% block content_end %}
<script type="text/javascript" src="/js/doc-history.js"></script>
<script type="text/javascript" src="/js/history.js"></script>
{% endblock content_end %}

View file

@ -133,6 +133,8 @@ table.ballot_icon td.ballot_icon_my { border: 3px outset black;}
.ietf-highlight-r { padding:0 2px;background:#ffa0a0;}
.ietf-divider { background: #2647a0; color: white; font-size:116%; padding:0.5em 1em; }
table.history .snippet .showAll { color: blue; cursor: pointer; }
.error-text {
font-size: 1.095em;
width: 48em;