Now that the timeline stuff seems stable, show it for all document types.
- Legacy-Id: 10555
This commit is contained in:
parent
b6e02b1c1f
commit
0f1c823a6e
|
@ -11,5 +11,6 @@ indent_style = space
|
|||
indent_size = 4
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
# to avoid tripping Henrik's commit hook:
|
||||
trim_trailing_whitespace = false
|
||||
insert_final_newline = false
|
||||
|
|
|
@ -65,7 +65,7 @@ urlpatterns = patterns('',
|
|||
url(r'^(?P<name>[A-Za-z0-9._+-]+)/ballot/(?P<ballot_id>[0-9]+)/emailposition/$', views_ballot.send_ballot_comment, name='doc_send_ballot_comment'),
|
||||
url(r'^(?P<name>[A-Za-z0-9._+-]+)/ballot/(?P<ballot_id>[0-9]+)/$', views_doc.document_ballot, name="doc_ballot"),
|
||||
url(r'^(?P<name>[A-Za-z0-9._+-]+)/ballot/$', views_doc.document_ballot, name="doc_ballot"),
|
||||
(r'^(?P<name>[A-Za-z0-9._+-]+)/doc.json$', views_doc.document_json),
|
||||
(r'^(?P<name>[A-Za-z0-9._+-]+)/(?:(?P<rev>[0-9-]+)/)?doc.json$', views_doc.document_json),
|
||||
(r'^(?P<name>[A-Za-z0-9._+-]+)/ballotpopup/(?P<ballot_id>[0-9]+)/$', views_doc.ballot_popup),
|
||||
|
||||
url(r'^(?P<name>[A-Za-z0-9._+-]+)/email-aliases/$', RedirectView.as_view(pattern_name='doc_email', permanent=False),name='doc_specific_email_aliases'),
|
||||
|
|
|
@ -878,7 +878,7 @@ def ballot_popup(request, name, ballot_id):
|
|||
context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def document_json(request, name):
|
||||
def document_json(request, name, rev=None):
|
||||
doc = get_object_or_404(Document, docalias__name=name)
|
||||
|
||||
def extract_name(s):
|
||||
|
|
|
@ -426,3 +426,31 @@ h1 small .pull-right { margin-top: 10.5px; }
|
|||
*/
|
||||
form.navbar-form input.form-control.input-sm { width: 141px; }
|
||||
|
||||
|
||||
|
||||
/* Styles for d3.js graphical SVG timelines */
|
||||
#timeline { font-size: small; }
|
||||
|
||||
#timeline .axis path, #timeline .axis line {
|
||||
fill: none;
|
||||
stroke: black;
|
||||
}
|
||||
|
||||
#timeline .axis.y path, #timeline .axis.y line { stroke: none; }
|
||||
|
||||
#timeline .axis.x text { dominant-baseline: central; }
|
||||
|
||||
#timeline .bar text {
|
||||
fill: white;
|
||||
dominant-baseline: central;
|
||||
}
|
||||
|
||||
/* like label-success */
|
||||
#timeline .bar:nth-child(odd) rect { fill: #5CB85C; }
|
||||
|
||||
/* like label-primary */
|
||||
#timeline .bar:nth-child(even) rect { fill: #337AB7; }
|
||||
|
||||
/* like label-warning */
|
||||
#timeline .gradient.left { stop-color: #F0AD4E; }
|
||||
#timeline .gradient.right { stop-color: white; }
|
||||
|
|
|
@ -10,7 +10,7 @@ var width;
|
|||
|
||||
function offset(d, i) {
|
||||
// increase the y offset if the document name changed in this revision
|
||||
if (i > 0 && data[i - 1].name !== d.name || d.rev.match("rfc"))
|
||||
if (i > 0 && data[i - 1].name !== d.name || d.rev.match("^rfc\d+$"))
|
||||
bar_y += bar_height;
|
||||
return "translate(" + x_scale(d.published) + ", " + bar_y + ")";
|
||||
}
|
||||
|
@ -59,8 +59,7 @@ function update_timeline() {
|
|||
|
||||
|
||||
function draw_timeline() {
|
||||
bar_height = parseFloat($("body").css('line-height'));
|
||||
// bar_height = 20;
|
||||
bar_height = parseFloat($("body").css("line-height"));
|
||||
|
||||
var div = $("#timeline");
|
||||
if (div.is(":empty"))
|
||||
|
@ -70,12 +69,16 @@ function draw_timeline() {
|
|||
var gradient = chart.append("defs")
|
||||
.append("linearGradient")
|
||||
.attr("id", "gradient");
|
||||
gradient.append('stop')
|
||||
.attr('class', 'stop-left')
|
||||
.attr('offset', '0');
|
||||
gradient.append('stop')
|
||||
.attr('class', 'stop-right')
|
||||
.attr('offset', '1');
|
||||
gradient.append("stop")
|
||||
.attr({
|
||||
class: "gradient left",
|
||||
offset: 0
|
||||
});
|
||||
gradient.append("stop")
|
||||
.attr({
|
||||
class: "gradient right",
|
||||
offset: 1
|
||||
});
|
||||
|
||||
var y_labels = data
|
||||
.map(function(elem) { return elem.name; })
|
||||
|
@ -121,6 +124,10 @@ function draw_timeline() {
|
|||
})
|
||||
.text(function(d) { return d.rev; });
|
||||
|
||||
// since the gradient is defined inside the SVG, we need to set the CSS
|
||||
// style here, so the relative URL works
|
||||
$("#timeline .bar:nth-last-child(2) rect").css("fill", "url(#gradient)");
|
||||
|
||||
var y_scale = d3.scale.ordinal()
|
||||
.domain(y_labels)
|
||||
.rangePoints([0, bar_y]);
|
||||
|
@ -150,22 +157,24 @@ function draw_timeline() {
|
|||
d3.select(".x.axis").each(function() {
|
||||
x_label_height = this.getBBox().height;
|
||||
});
|
||||
chart.attr('height', bar_y + x_label_height);
|
||||
chart.attr("height", bar_y + x_label_height);
|
||||
}
|
||||
|
||||
|
||||
d3.json("doc.json", function(error, json) {
|
||||
if (error) return; // console.warn(error);
|
||||
if (error) return;
|
||||
data = json["rev_history"];
|
||||
|
||||
// make js dates out of publication dates
|
||||
data.forEach(function(d) { d.published = new Date(d.published); });
|
||||
if (data.length) {
|
||||
// make js dates out of publication dates
|
||||
data.forEach(function(d) { d.published = new Date(d.published); });
|
||||
|
||||
// add pseudo entry 185 days after last revision (when the ID will expire)
|
||||
var pseudo = new Date(data[data.length - 1].published.getTime() +
|
||||
1000*60*60*24*185);
|
||||
data.push({ name: "", rev: "", published: pseudo});
|
||||
draw_timeline();
|
||||
// add pseudo entry 185 days after last rev (when the ID will expire)
|
||||
var pseudo = new Date(data[data.length - 1].published.getTime() +
|
||||
1000*60*60*24*185);
|
||||
data.push({ name: "", rev: "", published: pseudo});
|
||||
draw_timeline();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
{{ top|safe }}
|
||||
|
||||
{% include "doc/revisions_list.html" %}
|
||||
<div id="timeline"></div>
|
||||
|
||||
<table class="table table-condensed">
|
||||
<thead id="message-row">
|
||||
|
@ -210,3 +211,7 @@
|
|||
|
||||
{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
<script src="{% static 'd3/d3.min.js' %}"></script>
|
||||
<script src="{% static 'ietf/js/document_timeline.js' %}"></script>
|
||||
{% endblock %}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
{{ top|safe }}
|
||||
|
||||
{% include "doc/revisions_list.html" %}
|
||||
<div id="timeline"></div>
|
||||
|
||||
<table class="table table-condensed">
|
||||
<thead id="message-row">
|
||||
|
@ -137,6 +138,10 @@
|
|||
<p></p>
|
||||
{{ content|fill:"80"|safe|linebreaksbr|keep_spacing|sanitize_html|safe }}
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block js %}
|
||||
<script src="{% static 'd3/d3.min.js' %}"></script>
|
||||
<script src="{% static 'ietf/js/document_timeline.js' %}"></script>
|
||||
{% endblock %}
|
||||
|
|
|
@ -11,33 +11,6 @@
|
|||
|
||||
{% block morecss %}
|
||||
.inline { display: inline; }
|
||||
|
||||
#timeline { font-size: small; }
|
||||
|
||||
#timeline .axis path, #timeline .axis line {
|
||||
fill: none;
|
||||
stroke: black;
|
||||
}
|
||||
|
||||
#timeline .axis.y path, #timeline .axis.y line { stroke: none; }
|
||||
|
||||
#timeline .axis.x text { dominant-baseline: central; }
|
||||
|
||||
#timeline .bar text {
|
||||
fill: white;
|
||||
dominant-baseline: central;
|
||||
}
|
||||
|
||||
{% comment %} like label-success {% endcomment %}
|
||||
#timeline .bar:nth-child(odd) rect { fill: #5CB85C; }
|
||||
|
||||
{% comment %} like label-primary {% endcomment %}
|
||||
#timeline .bar:nth-child(even) rect { fill: #337AB7; }
|
||||
|
||||
{% comment %} like label-warning {% endcomment %}
|
||||
.stop-left { stop-color: #F0AD4E; }
|
||||
.stop-right { stop-color: white; }
|
||||
#timeline .bar:nth-last-child(4) rect { fill: url(#gradient); }
|
||||
{% endblock %}
|
||||
|
||||
{% block title %}
|
||||
|
@ -520,10 +493,8 @@
|
|||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block js %}
|
||||
<script src="{% static 'd3/d3.min.js' %}"></script>
|
||||
<script src="{% static 'ietf/js/document_timeline.js' %}"></script>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% extends "base.html" %}
|
||||
{# Copyright The IETF Trust 2015, All Rights Reserved #}
|
||||
{% load origin %}
|
||||
|
||||
{% load staticfiles %}
|
||||
{% load ietf_filters %}
|
||||
|
||||
{% block title %}{{ doc.title }}{% endblock %}
|
||||
|
@ -11,6 +11,7 @@
|
|||
{{ top|safe }}
|
||||
|
||||
{% include "doc/revisions_list.html" %}
|
||||
<div id="timeline"></div>
|
||||
|
||||
<table class="table table-condensed">
|
||||
<thead id="message-row">
|
||||
|
@ -125,5 +126,10 @@
|
|||
<p class="download-instead"><a href="{{ other_types.0.1 }}">Download as {{ other_types.0.0.upper }}</a></p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block js %}
|
||||
<script src="{% static 'd3/d3.min.js' %}"></script>
|
||||
<script src="{% static 'ietf/js/document_timeline.js' %}"></script>
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% extends "base.html" %}
|
||||
{# Copyright The IETF Trust 2015, All Rights Reserved #}
|
||||
{% load origin %}
|
||||
|
||||
{% load staticfiles %}
|
||||
{% load ietf_filters %}
|
||||
|
||||
{% block title %}{{ doc.title }}{% endblock %}
|
||||
|
@ -11,6 +11,7 @@
|
|||
{{ top|safe }}
|
||||
|
||||
{% include "doc/revisions_list.html" %}
|
||||
<div id="timeline"></div>
|
||||
|
||||
<table class="table table-condensed">
|
||||
<thead id="message-row">
|
||||
|
@ -153,3 +154,8 @@
|
|||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block js %}
|
||||
<script src="{% static 'd3/d3.min.js' %}"></script>
|
||||
<script src="{% static 'ietf/js/document_timeline.js' %}"></script>
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in a new issue