Summary: Facelift material document page
- Legacy-Id: 8937
This commit is contained in:
parent
7561ce463d
commit
88c9f84664
|
@ -463,18 +463,11 @@ def format_snippet(text, trunc_words=25):
|
|||
return mark_safe(u'<div class="snippet">%s<button class="btn btn-xs btn-default show-all"><span class="fa fa-caret-down"></span></button></div><div class="hidden full">%s</div>' % (snippet, full))
|
||||
return full
|
||||
|
||||
@register.filter
|
||||
def format_editable_snippet(text,link):
|
||||
full = mark_safe(keep_spacing(collapsebr(linebreaksbr(urlize(sanitize_html(text))))))
|
||||
snippet = truncatewords_html(full, 25)
|
||||
if snippet != full:
|
||||
return mark_safe(u'<div class="snippet">%s<span class="show-all">[show all]</span></div><div style="display:none" class="full">%s' % (format_editable(snippet,link),format_editable(full,link)) )
|
||||
else:
|
||||
return format_editable(full,link)
|
||||
|
||||
@register.filter
|
||||
def format_editable(text,link):
|
||||
return mark_safe(u'<a class="editlink" href="%s">%s</a>' % (link,text))
|
||||
@register.simple_tag
|
||||
def doc_edit_button(url_name, *args, **kwargs):
|
||||
"""Given URL name/args/kwargs, looks up the URL just like "url" tag and returns a properly formatted button for the document material tables."""
|
||||
from django.core.urlresolvers import reverse as urlreverse
|
||||
return mark_safe(u'<a class="btn btn-default btn-xs" href="%s">Edit</a>' % (urlreverse(url_name, args=args, kwargs=kwargs)))
|
||||
|
||||
@register.filter
|
||||
def textify(text):
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
{% block content %}
|
||||
<h1>{{ title }}</h1>
|
||||
|
||||
<form role="form" class="change-title" method="post">{% csrf_token %}
|
||||
<form role="form" class="change-title" method="post">
|
||||
{% csrf_token %}
|
||||
|
||||
{% bootstrap_form form %}
|
||||
|
||||
{% buttons %}
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
</th>
|
||||
<td class="edit"></td>
|
||||
<td>
|
||||
{{ group.name }} {{ group.type.name }}
|
||||
<a href="{{ group.about_url }}">({{ group.acronym }})</a> {{ group.type.name }}
|
||||
{{ group.name }} {{ group.type.name }}
|
||||
<a href="{{ group.about_url }}">({{ group.acronym }})</a>
|
||||
|
||||
{% if snapshot %}
|
||||
<span class="label label-warning">Snapshot</span>
|
||||
|
@ -40,9 +40,9 @@
|
|||
<tr>
|
||||
<th>Title</th>
|
||||
<td class="edit">
|
||||
{% if not snapshot and can_manage %}
|
||||
<a class="btn btn-default btn-xs pull-right" href="{% url "charter_change_title" name=doc.name %}">Edit</a>
|
||||
{% endif %}
|
||||
{% if not snapshot and can_manage %}
|
||||
{% doc_edit_button "charter_change_title" name=doc.name %}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ doc.title }}</td>
|
||||
</tr>
|
||||
|
@ -57,11 +57,11 @@
|
|||
<th><a href="/doc/help/state/charter/">Charter state</a></th>
|
||||
<td class="edit">
|
||||
{% if not snapshot and can_manage %}
|
||||
<a class="btn btn-default btn-xs pull-right" title="{{ doc.get_state.desc }}" href="{% url "charter_change_state" name=doc.name %}">Edit</a>
|
||||
{% endif %}
|
||||
{% doc_edit_button "charter_change_state" name=doc.name %}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{{ doc.get_state.name }}
|
||||
<span title="{{ doc.get_state.desc }}">{{ doc.get_state.name }}</span>
|
||||
|
||||
{% if chartering == "initial" %}
|
||||
<span class="label label-info">Initial chartering</span>
|
||||
|
@ -77,8 +77,8 @@
|
|||
<th>Telechat date</th>
|
||||
<td class="edit">
|
||||
{% if can_manage %}
|
||||
<a class="btn btn-default btn-xs pull-right" href="{% url "charter_telechat_date" name=doc.name %}">Edit</a>
|
||||
{% endif %}
|
||||
{% doc_edit_button "charter_telechat_date" name=doc.name %}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if not telechat %}
|
||||
|
@ -97,8 +97,8 @@
|
|||
<th>Responsible AD</th>
|
||||
<td class="edit">
|
||||
{% if can_manage %}
|
||||
<a class="btn btn-default btn-xs pull-right" href="{% url "charter_edit_ad" name=doc.name %}">Edit</a>
|
||||
{% endif %}
|
||||
{% doc_edit_button "charter_edit_ad" name=doc.name %}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{{ doc.ad|default:"(None)" }}
|
||||
|
@ -109,7 +109,7 @@
|
|||
<th>Send notices to</th>
|
||||
<td class="edit">
|
||||
{% if can_manage %}
|
||||
<a class="btn btn-default btn-xs pull-right" href="{% url "charter_edit_notify" name=doc.name %}">Edit</a>
|
||||
{% doc_edit_button "charter_edit_notify" name=doc.name %}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
|
|
|
@ -1,108 +1,108 @@
|
|||
{% extends "base.html" %}
|
||||
{% extends "ietf.html" %}
|
||||
|
||||
{% load ietf_filters %}
|
||||
|
||||
{% block title %}{{ doc.canonical_name }}-{{ doc.rev }}{% endblock %}
|
||||
|
||||
{% block pagehead %}
|
||||
<link rel="stylesheet" type="text/css" href="/css/doc.css"></link>
|
||||
{% endblock %}
|
||||
{% block title %}{{ doc.title }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{{ top|safe }}
|
||||
|
||||
{% include "doc/revisions_list.html" %}
|
||||
|
||||
<div class="ietf-box metabox">
|
||||
<div>
|
||||
{% if snapshot %}Snapshot of{% endif %} {% if doc.meeting_related %}Meeting{% endif %} {{ doc.type.name }} for <a href="{{ doc.group.about_url }}">{{ doc.group.acronym }}</a> group
|
||||
</div>
|
||||
<table class="table table-condensed table-striped">
|
||||
<tr>
|
||||
<th>{% if doc.meeting_related %}Meeting{% endif %} {{ doc.type.name }}</th>
|
||||
<td class="edit"></td>
|
||||
<td>
|
||||
{{ doc.group.name }}
|
||||
<a href="{{ doc.group.about_url }}">({{ doc.group.acronym }})</a> {{ doc.group.type.name }}
|
||||
|
||||
<table id="metatable" width="100%">
|
||||
{% if snapshot %}
|
||||
<span class="label label-warning">Snapshot</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
<td class="edit">
|
||||
{% if not snapshot and can_manage_material %}
|
||||
{% doc_edit_button "material_edit" name=doc.name action="title" %}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ doc.title }}</td>
|
||||
</tr>
|
||||
|
||||
{% if doc.abstract %}
|
||||
<tr>
|
||||
<td>Title:</td>
|
||||
<td>
|
||||
<th>Abstract</th>
|
||||
<td class="edit">
|
||||
{% if not snapshot and can_manage_material %}
|
||||
{% url "material_edit" name=doc.name action="title" as editurl %}
|
||||
{{ doc.title | format_editable:editurl }}
|
||||
{% else %}
|
||||
{{ doc.title }}
|
||||
{% doc_edit_button "material_edit" name=doc.name action="abstract" %}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ doc.abstract|format_snippet }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
|
||||
{% if doc.abstract %}
|
||||
<tr>
|
||||
<td>Abstract:</td>
|
||||
<td>
|
||||
{% if not snapshot and can_manage_material %}
|
||||
{% url "material_edit" name=doc.name action="abstract" as editurl %}
|
||||
{{ doc.abstract | format_editable_snippet:editurl }}
|
||||
{% else %}
|
||||
{{ doc.abstract | format_snippet }}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
<tr>
|
||||
<th>State</th>
|
||||
<td class="edit">
|
||||
{% if not snapshot and can_manage_material %}
|
||||
{% doc_edit_button "material_edit" name=doc.name action="state" %}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ doc.get_state.name }}</td>
|
||||
</tr>
|
||||
|
||||
{% if other_types %}
|
||||
<tr>
|
||||
<td>State:</td>
|
||||
<td>
|
||||
{% if not snapshot and can_manage_material %}
|
||||
{% url "material_edit" name=doc.name action="state" as editurl %}
|
||||
{{ doc.get_state.name | format_editable:editurl }}
|
||||
{% else %}
|
||||
{{ doc.get_state.name }}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{% if other_types %}
|
||||
<tr>
|
||||
<td>Other versions:</td>
|
||||
<th>Other versions</th>
|
||||
<td class="edit"></td>
|
||||
<td>
|
||||
{% for t, url in other_types %}
|
||||
<a href="{{ url }}">{{ t }}</a>{% if not forloop.last %},{% endif %}
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if presentations or can_manage_material %}
|
||||
{% if presentations or can_manage_material %}
|
||||
<tr>
|
||||
<td>On Agenda:</td>
|
||||
<th>On Agenda</th>
|
||||
<td class="edit">
|
||||
{% if not snapshot and can_manage_material %}
|
||||
{% doc_edit_button "material_presentations" name=doc.name %}
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<a {% if not snapshot and can_manage_material %} class="editlink" href="{% url "material_presentations" name=doc.name %}"{%endif%}>
|
||||
{% if presentations %}
|
||||
{% for pres in presentations %}{{pres.session.short_name}} at {{pres.session.meeting}} {% if pres.rev != doc.rev %}(version -{{pres.rev}}){% endif %}{% if not forloop.last %}, {% endif %}{% endfor %}
|
||||
{% else %}
|
||||
None
|
||||
{% endif %}
|
||||
</a>
|
||||
</td>
|
||||
{% if presentations %}
|
||||
{% for pres in presentations %}{{ pres.session.short_name }} at {{ pres.session.meeting }} {% if pres.rev != doc.rev %}(version -{{ pres.rev }}){% endif %}{% if not forloop.last %}, {% endif %}{% endfor %}
|
||||
{% else %}
|
||||
None
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<tr>
|
||||
<td>Last updated:</td>
|
||||
<td>{{ doc.time|date:"Y-m-d" }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Last updated</th>
|
||||
<td class="edit"></td>
|
||||
<td>{{ doc.time|date:"Y-m-d" }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
{% if not snapshot and can_manage_material %}
|
||||
<tr><td colspan="2">
|
||||
<a class="button" href="{% url "material_edit" name=doc.name action="revise" %}">Upload New Revision</a>
|
||||
</td><tr/>
|
||||
{% endif %}
|
||||
<p class="buttonlist">
|
||||
{% if not snapshot and can_manage_material %}
|
||||
<a class="btn btn-default" href="{% url "material_edit" name=doc.name action="revise" %}">Upload New Revision</a>
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<h2>{% if doc.meeting_related %}Meeting{% endif %} {{ doc.type.name }}<br><small>{{ doc.name }}</small></h2>
|
||||
|
||||
{% if doc.rev and content != None %}
|
||||
<h3>{{ doc.title }}</h3>
|
||||
|
||||
<div class="markup_draft">
|
||||
{{ content|fill:"80"|safe|linebreaksbr|keep_spacing|sanitize_html|safe }}
|
||||
</div>
|
||||
{% else %}
|
||||
<p>Not available as plain text.</p>
|
||||
|
||||
|
@ -112,7 +112,3 @@
|
|||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block content_end %}
|
||||
<script src="/js/snippet.js" type="text/javascript"></script>
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in a new issue