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.
This commit is contained in:
Adam Waldenberg 2013-07-26 03:18:00 +02:00
parent 67418fa25d
commit 171474a501
2 changed files with 46 additions and 16 deletions

View File

@ -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("<div class=\"button\">{show_minor_authors} (" + hiddenResponsibilitiesCount + ") &or;</div>");
$("div#responsibilities div.button").toggle(function() {{
this.innerHTML = "{hide_minor_authors} (" + hiddenResponsibilitiesCount + ") &and;";
$("div#responsibilities div").show();
}}, function() {{
this.innerHTML = "{show_minor_authors} (" + hiddenResponsibilitiesCount + ") &or;";
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;
}}
</style>
</head>
<body>

View File

@ -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 += "<div>"
if format.get_selected() == "html":
author_email = self.changes.get_author_email(i)
resp_xml += "<h3><img src=\"{0}\"/>{1} {2}</h3>".format(gravatar.get_url(author_email, size=32),
@ -90,10 +92,10 @@ class ResponsibilitiesOutput(Outputable):
for j, entry in enumerate(responsibilities):
resp_xml += "<div" + (" class=\"odd\">" if j % 2 == 1 else ">") + entry[1] + \
" (" + str(entry[0]) + " eloc)</div>"
if j >= 9:
break
resp_xml += "</div>"
resp_xml += "</div></div>"
print(resp_xml)