From 65481c013ec99a9280172f5542ad9251f3e25aa2 Mon Sep 17 00:00:00 2001 From: Adam Waldenberg Date: Thu, 9 May 2013 02:45:12 +0200 Subject: [PATCH] Added filtering to the HTML timeline. Rows with minor work are filtered; these are rows that contain very little work (only dots). The filtering can be toggled by pressing a button. --- html/html.header | 45 ++++++++++++++++++++++++++++++++++++++++----- timeline.py | 2 +- 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/html/html.header b/html/html.header index d63fa08..ff10252 100644 --- a/html/html.header +++ b/html/html.header @@ -23,6 +23,12 @@ }} }} + var filterTimeLine = function() {{ + $("div#timeline table.git tbody tr").filter(function() {{ + return $(this).find("td:has(div)").length == 0; + }}).hide(); + }} + $("table.git tbody tr td:last-child").filter(function() {{ return parseFloat(this.innerHTML) < MINOR_AUTHOR_PERCENTAGE; }}).parent().hide(); @@ -47,6 +53,26 @@ }}).parent().hide(); $("table.git tbody tr:visible").each(colorRows); }}); + + filterTimeLine(); + + if ($("div#timeline table.git tbody tr:hidden").length > 0) {{ + $("div#timeline table.git tbody tr:visible").each(colorRows); + $("div#timeline").prepend("
Show rows with minor work ∨
"); + + $("div#timeline div.button").hover(function() {{ + $(this).addClass("hover"); + }}, function() {{ + $(this).removeClass("hover"); + }}).toggle(function() {{ + this.innerHTML = "Hide rows with minor work ∧" + $("div#timeline table.git tbody tr").show().each(colorRows); + }}, function() {{ + this.innerHTML = "Show rows with minor work ∨"; + filterTimeLine(); + $("div#timeline table.git tbody tr:visible").each(colorRows); + }}); + }} }}); diff --git a/timeline.py b/timeline.py index 433afa8..7f8e1f1 100644 --- a/timeline.py +++ b/timeline.py @@ -188,7 +188,7 @@ class Timeline(Outputable): names = timeline_data.get_authors() max_periods_per_row = 8 - timeline_xml = "
" + timeline_xml = "
" timeline_xml += "

" + __timeline_info_text__ + ".

" print(timeline_xml)