Skip to content

Commit a9525ab

Browse files
committed
Revamp stats selector UI a bit to accomodate statistics counting
authors (instead of documents), add stats with documents per author - Legacy-Id: 12766
1 parent b645a8c commit a9525ab

14 files changed

Lines changed: 314 additions & 167 deletions

ietf/static/ietf/js/document-stats.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,26 @@ $(document).ready(function () {
1515
var chart = Highcharts.chart('chart', window.chartConf);
1616
}
1717

18-
$(".popover-docnames").each(function () {
18+
$(".popover-details").each(function () {
1919
var stdNameRegExp = new RegExp("^(rfc|bcp|fyi|std)[0-9]+$", 'i');
20+
var draftRegExp = new RegExp("^draft-", 'i');
2021

21-
var html = [];
22-
$.each(($(this).data("docnames") || "").split(" "), function (i, docname) {
23-
if (!$.trim(docname))
22+
var html = [];t
23+
$.each(($(this).data("elements") || "").split("|"), function (i, element) {
24+
if (!$.trim(element))
2425
return;
2526

26-
var displayName = docname;
27+
if (draftRegExp.test(element) || stdNameRegExp.test(element)) {
28+
var displayName = element;
2729

28-
if (stdNameRegExp.test(docname))
29-
displayName = docname.slice(0, 3).toUpperCase() + " " + docname.slice(3);
30+
if (stdNameRegExp.test(element))
31+
displayName = element.slice(0, 3).toUpperCase() + " " + element.slice(3);
3032

31-
html.push('<div class="docname"><a href="/doc/' + docname + '/">' + displayName + '</a></div>');
33+
html.push('<div class="docname"><a href="/doc/' + element + '/">' + displayName + '</a></div>');
34+
}
35+
else {
36+
html.push('<div>' + element + '</div>');
37+
}
3238
});
3339

3440
if ($(this).data("sliced"))

ietf/stats/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def test_document_stats(self):
2525
self.assertTrue(authors_url in r["Location"])
2626

2727
# check various stats types
28-
for stats_type in ["authors", "pages", "words", "format", "formlang"]:
28+
for stats_type in ["authors", "pages", "words", "format", "formlang", "author/documents"]:
2929
for document_type in ["", "rfc", "draft"]:
3030
for time_choice in ["", "5y"]:
3131
url = urlreverse(ietf.stats.views.document_stats, kwargs={ "stats_type": stats_type })

ietf/stats/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55

66
urlpatterns = patterns('',
77
url("^$", ietf.stats.views.stats_index),
8-
url("^document/(?:(?P<stats_type>authors|pages|words|format|formlang)/)?$", ietf.stats.views.document_stats),
8+
url("^document/(?:(?P<stats_type>authors|pages|words|format|formlang|author/documents|author/affiliation|author/country|author/continent|author/citation)/)?$", ietf.stats.views.document_stats),
99
url("^review/(?:(?P<stats_type>completion|results|states|time)/)?(?:%(acronym)s/)?$" % settings.URL_REGEXPS, ietf.stats.views.review_stats),
1010
)

0 commit comments

Comments
 (0)