Add History tab at /wg/[acronym]/ page, move group history entries
from charter to this page - Legacy-Id: 3818
This commit is contained in:
parent
201edb3dd3
commit
04bce10521
|
@ -4,7 +4,7 @@ import textwrap
|
|||
from django import template
|
||||
from django.conf import settings
|
||||
from django.utils.html import escape, fix_ampersands
|
||||
from django.template.defaultfilters import linebreaksbr, wordwrap, stringfilter
|
||||
from django.template.defaultfilters import linebreaksbr, wordwrap, stringfilter, urlize, truncatewords_html
|
||||
from django.template import resolve_variable
|
||||
from django.utils.safestring import mark_safe, SafeData
|
||||
try:
|
||||
|
@ -440,6 +440,15 @@ def ad_area(user):
|
|||
return g[0].acronym
|
||||
return None
|
||||
|
||||
@register.filter
|
||||
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))
|
||||
return full
|
||||
|
||||
def _test():
|
||||
import doctest
|
||||
doctest.testmod()
|
||||
|
|
25
ietf/templates/wginfo/history.html
Normal file
25
ietf/templates/wginfo/history.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
{% extends "wginfo/wg_base.html" %}
|
||||
{% load ietf_filters %}
|
||||
|
||||
{% block wg_titledetail %}History{% endblock %}
|
||||
|
||||
{% block wg_content %}
|
||||
{% load ietf_filters %}
|
||||
|
||||
<h2>WG History</h2>
|
||||
|
||||
<table class="ietf-table history">
|
||||
<tr><th>Date</th><th>By</th><th>Text</th></tr>
|
||||
{% for e in events %}
|
||||
<tr class="{% cycle oddrow,evenrow %}">
|
||||
<td>{{ e.time|date:"Y-m-d"}}</td>
|
||||
<td>{{ e.by.name }}</td>
|
||||
<td>{{ e.desc|format_history_text }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% endblock %}
|
||||
|
||||
{% block content_end %}
|
||||
<script src="/js/history.js" type="text/javascript"></script>
|
||||
{% endblock %}
|
|
@ -58,9 +58,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
<h1>{{wg.group_acronym.name}} ({{wg.group_acronym.acronym}}){% if concluded %}<br/><span class="ietf-concluded-warning">(concluded WG)</span>{% endif %}{% if proposed %}<br/><span class="ietf-proposed-warning">(proposed WG)</span>{% endif %}</h1>
|
||||
|
||||
<div class="ietf-navset">
|
||||
{% ifequal selected "documents" %}<span class="selected">Documents</span>{% else %}<a href="/wg/{{wg}}/">Documents</a>{% endifequal %} |
|
||||
{% ifequal selected "charter" %}<span class="selected">Charter</span>{% else %}<a href="/wg/{{wg}}/charter/">Charter</a>{% endifequal %} |
|
||||
{% ifequal selected "documents" %}<span class="selected">Documents</span>{% else %}<a href="{% url wginfo.views.wg_documents_html acronym=wg.group_acronym.acronym %}">Documents</a>{% endifequal %} |
|
||||
{% ifequal selected "charter" %}<span class="selected">Charter</span>{% else %}<a href="{% url wginfo.views.wg_charter acronym=wg.group_acronym.acronym %}">Charter</a>{% endifequal %} |
|
||||
{% wgchairs_admin_options wg %}
|
||||
<a {% if selected == "history" %}class="selected"{% else %}href="{% url wginfo.views.history acronym=wg.group_acronym.acronym %}"{% endif %}>History</a> |
|
||||
{% if wg.clean_email_archive|startswith:"http:" or wg.clean_email_archive|startswith:"ftp:" %}
|
||||
<a href="{{ wg.clean_email_archive }}">List Archive »</a> |
|
||||
{% endif %}
|
||||
|
|
|
@ -84,7 +84,7 @@ def wg_main(request, name, rev, tab):
|
|||
"charter-ietf-"+str(gh.acronym)+"-"+str(ch.rev)+".txt",
|
||||
os.path.join(file_path, "charter-ietf-"+gh.acronym+"-"+ch.rev+".txt"))
|
||||
active_ads = Person.objects.filter(email__role__name="ad", email__role__group__state="active").distinct()
|
||||
started_process = datetime.datetime.min
|
||||
started_process = datetime.min
|
||||
e = wg.charter.latest_event(type="started_iesg_process")
|
||||
if e:
|
||||
started_process = e.time
|
||||
|
@ -148,17 +148,6 @@ def wg_main(request, name, rev, tab):
|
|||
|
||||
def _get_history(wg, versions=None):
|
||||
results = []
|
||||
for e in wg.groupevent_set.all().select_related('by').order_by('-time', 'id'):
|
||||
info = {}
|
||||
|
||||
charter_history = find_history_active_at(wg.charter, e.time)
|
||||
info['version'] = charter_history.rev if charter_history else wg.charter.rev
|
||||
info['text'] = e.desc
|
||||
info['by'] = e.by.name
|
||||
info['textSnippet'] = truncatewords_html(format_textarea(fill(info['text'], 80)), 25)
|
||||
info['snipped'] = info['textSnippet'][-3:] == "..."
|
||||
results.append({'comment':e, 'info':info, 'date':e.time, 'group': wg, 'is_com':True})
|
||||
|
||||
for e in wg.charter.docevent_set.all().order_by('-time'):
|
||||
info = {}
|
||||
charter_history = find_history_active_at(wg.charter, e.time)
|
||||
|
|
|
@ -16,5 +16,6 @@ urlpatterns = patterns('',
|
|||
(r'^(?P<acronym>[a-zA-Z0-9-]+)/documents/txt/$', views.wg_documents_txt),
|
||||
(r'^(?P<acronym>[a-zA-Z0-9-]+)/$', views.wg_documents_html),
|
||||
(r'^(?P<acronym>[a-zA-Z0-9-]+)/charter/$', views.wg_charter),
|
||||
(r'^(?P<acronym>[a-zA-Z0-9-]+)/history/', views.history),
|
||||
(r'^(?P<acronym>[^/]+)/management/', include('ietf.wgchairs.urls')),
|
||||
)
|
||||
|
|
|
@ -40,6 +40,7 @@ from ietf.idtracker.models import Area, IETFWG
|
|||
from ietf.idrfc.views_search import SearchForm, search_query
|
||||
from ietf.idrfc.idrfc_wrapper import IdRfcWrapper
|
||||
from ietf.ipr.models import IprDetail
|
||||
from redesign.group.models import Group
|
||||
|
||||
|
||||
def fill_in_charter_info(wg, include_drafts=False):
|
||||
|
@ -156,3 +157,22 @@ def wg_charter(request, acronym):
|
|||
RequestContext(request))
|
||||
|
||||
return render_to_response('wginfo/wg_charter.html', {'wg': wg, 'concluded':concluded, 'proposed': proposed, 'selected':'charter'}, RequestContext(request))
|
||||
|
||||
def get_wg_menu_context(wg, selected):
|
||||
# it would probably be better to refactor this file into rendering
|
||||
# the menu separately instead of each view having to include the information
|
||||
|
||||
return dict(wg=wg, concluded=wg.state_id == "conclude", proposed=wg.state_id == "proposed", selected=selected)
|
||||
|
||||
def history(request, acronym):
|
||||
wg = get_object_or_404(Group, acronym=acronym)
|
||||
|
||||
events = wg.groupevent_set.all().select_related('by').order_by('-time', '-id')
|
||||
|
||||
context = get_wg_menu_context(wg, "history")
|
||||
context.update(dict(events=events,
|
||||
))
|
||||
|
||||
wg.group_acronym = wg # hack for compatibility with old templates
|
||||
|
||||
return render_to_response('wginfo/history.html', context, RequestContext(request))
|
||||
|
|
5
static/js/history.js
Normal file
5
static/js/history.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
jQuery(function () {
|
||||
jQuery("table.history .snipped .showAll").click(function () {
|
||||
jQuery(this).parents("snipped").hide().siblings("full").show();
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue