From 171474a5017e08f76d8f46f563e75feaa2239018 Mon Sep 17 00:00:00 2001 From: Adam Waldenberg Date: Fri, 26 Jul 2013 03:18:00 +0200 Subject: [PATCH] Minor authors in the HTML responsibilities view are now collapsed. This works in the same manner as the other filtering available in the HTML view. The minor authors of the responsibilities view equal the minor authors of the blame view. --- gitinspector/html/html.header | 58 +++++++++++++++++++++++--------- gitinspector/responsibilities.py | 4 ++- 2 files changed, 46 insertions(+), 16 deletions(-) diff --git a/gitinspector/html/html.header b/gitinspector/html/html.header index c2c35e6..b870f59 100644 --- a/gitinspector/html/html.header +++ b/gitinspector/html/html.header @@ -25,13 +25,25 @@ }} }} + var filterResponsibilities = function() {{ + $("table#blame tbody tr td:last-child").filter(function() {{ + return parseFloat(this.innerHTML) < MINOR_AUTHOR_PERCENTAGE; + }}).parent().find("td:first-child").each(function() {{ + $("div#responsibilities div h3:contains(\"" + $(this).text() + "\")").parent().hide(); + }}); + }} + 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() {{ + $("table#changes tbody tr td:last-child").filter(function() {{ + return parseFloat(this.innerHTML) < MINOR_AUTHOR_PERCENTAGE; + }}).parent().hide(); + + $("table#blame tbody tr td:last-child").filter(function() {{ return parseFloat(this.innerHTML) < MINOR_AUTHOR_PERCENTAGE; }}).parent().hide(); @@ -80,8 +92,23 @@ $("table.git tbody tr:visible").each(colorRows); }}); - filterTimeLine(); + filterResponsibilities(); + var hiddenResponsibilitiesCount = $("div#responsibilities div h3:hidden").length; + if (hiddenResponsibilitiesCount > 0) {{ + $("div#responsibilities div h3:visible").each(colorRows); + $("div#responsibilities").prepend("
{show_minor_authors} (" + hiddenResponsibilitiesCount + ") ∨
"); + $("div#responsibilities div.button").toggle(function() {{ + this.innerHTML = "{hide_minor_authors} (" + hiddenResponsibilitiesCount + ") ∧"; + $("div#responsibilities div").show(); + }}, function() {{ + this.innerHTML = "{show_minor_authors} (" + hiddenResponsibilitiesCount + ") ∨"; + filterResponsibilities(); + }}); + }} + + + filterTimeLine(); var hiddenTimelineCount = $("div#timeline table.git tbody tr:hidden").length; if (hiddenTimelineCount > 0) {{ $("div#timeline table.git tbody tr:visible").each(colorRows); @@ -211,25 +238,16 @@ p.error {{ color: #700; }} - div.button {{ - border-radius: 8px 8px 8px 8px; - -moz-border-radius: 8px 8px 8px 8px; - border: 1px solid #eee; - float: right; - width: auto; - padding: 0.5em; - background-color: #ddcece; - min-height: 0; - }} table#changes thead tr th:hover, table#blame thead tr th:hover, - table#changes tfoot tr td.hoverable:hover, table#blame tfoot tr td.hoverable:hover, div.button:hover {{ + table#changes tfoot tr td.hoverable:hover, table#blame tfoot tr td.hoverable:hover, + div.button:hover, div#responsibilities div.button:hover {{ background-color: #eddede; border: 1px solid #bbb; cursor: hand; }} - div#responsibilities div {{ + div#responsibilities div, div#responsibilities div div {{ min-height: 0px; - padding: 0.3em 0.2em; + padding: 0.5em 0.2em; width: auto; }} div#responsibilities div.odd {{ @@ -256,6 +274,16 @@ background-color: #ddcece; margin-bottom: 0.2em; }} + div.button, div#responsibilities div.button {{ + border-radius: 8px 8px 8px 8px; + -moz-border-radius: 8px 8px 8px 8px; + border: 1px solid #eee; + float: right; + width: auto; + padding: 0.5em; + background-color: #ddcece; + min-height: 0; + }} diff --git a/gitinspector/responsibilities.py b/gitinspector/responsibilities.py index 6a9b7cf..deb3d18 100644 --- a/gitinspector/responsibilities.py +++ b/gitinspector/responsibilities.py @@ -80,6 +80,8 @@ class ResponsibilitiesOutput(Outputable): for i in sorted(set(i[0] for i in blame.get(self.hard).blames)): responsibilities = sorted(((i[1], i[0]) for i in Responsibilities.get(self.hard, i)), reverse=True) if responsibilities: + resp_xml += "
" + if format.get_selected() == "html": author_email = self.changes.get_author_email(i) resp_xml += "

{1} {2}

".format(gravatar.get_url(author_email, size=32), @@ -90,10 +92,10 @@ class ResponsibilitiesOutput(Outputable): for j, entry in enumerate(responsibilities): resp_xml += "" if j % 2 == 1 else ">") + entry[1] + \ " (" + str(entry[0]) + " eloc)
" - if j >= 9: break + resp_xml += "" resp_xml += "" print(resp_xml)