The HTML blame output now behaves similarly to the changes output (#28).

This commit is contained in:
Adam Waldenberg 2015-11-10 23:25:05 +01:00
parent dcbc6634f2
commit c90ac5a7ef
2 changed files with 4 additions and 9 deletions

View File

@ -41,16 +41,12 @@
}} }}
}}); }});
$("table#changes tbody tr td:last-child").filter(function() {{ $("table#changes tbody tr td:last-child, table#blame tbody tr td:last-child").filter(function() {{
return parseFloat(this.innerHTML) < MINOR_AUTHOR_PERCENTAGE; return parseFloat(this.innerHTML) < MINOR_AUTHOR_PERCENTAGE;
}}).parent().each(function() {{ }}).parent().each(function() {{
$(this).after("<tr></tr>").hide(); $(this).after("<tr></tr>").hide();
}}).hide(); }}).hide();
$("table#blame tbody tr td:last-child").filter(function() {{
return parseFloat(this.innerHTML) < MINOR_AUTHOR_PERCENTAGE;
}}).parent().hide();
$("table#changes thead tr th, table#blame thead tr th").click(function() {{ $("table#changes thead tr th, table#blame thead tr th").click(function() {{
$(this).parent().find("th strong").remove(); $(this).parent().find("th strong").remove();
var parentIndex = $(this).index(); var parentIndex = $(this).index();
@ -68,7 +64,7 @@
$(this).append("<strong> &#x25bc;</strong>"); $(this).append("<strong> &#x25bc;</strong>");
}}); }});
$("table#changes tfoot tr td:first-child").filter(function() {{ $("table#changes tfoot tr td:first-child, table#blame tfoot tr td:first-child").filter(function() {{
this.hiddenCount = $(this).parent().parent().parent().find("tbody tr:hidden").length; this.hiddenCount = $(this).parent().parent().parent().find("tbody tr:hidden").length;
return this.hiddenCount > 0; return this.hiddenCount > 0;
}}).each(function() {{ }}).each(function() {{

View File

@ -54,13 +54,12 @@ class BlameOutput(Outputable):
for i, entry in enumerate(blames): for i, entry in enumerate(blames):
work_percentage = str("{0:.2f}".format(100.0 * entry[1].rows / total_blames)) work_percentage = str("{0:.2f}".format(100.0 * entry[1].rows / total_blames))
blame_xml += "<tr " + ("class=\"odd\">" if i % 2 == 1 else ">")
if format.get_selected() == "html": if format.get_selected() == "html":
author_email = self.changes.get_latest_email_by_author(entry[0]) author_email = self.changes.get_latest_email_by_author(entry[0])
blame_xml += "<td><img src=\"{0}\"/>{1}</td>".format(gravatar.get_url(author_email), entry[0]) blame_xml += "<tr><td><img src=\"{0}\"/>{1}</td>".format(gravatar.get_url(author_email), entry[0])
else: else:
blame_xml += "<td>" + entry[0] + "</td>" blame_xml += "<tr><td>" + entry[0] + "</td>"
blame_xml += "<td>" + str(entry[1].rows) + "</td>" blame_xml += "<td>" + str(entry[1].rows) + "</td>"
blame_xml += "<td>" + ("{0:.1f}".format(Blame.get_stability(entry[0], entry[1].rows, self.changes)) + "</td>") blame_xml += "<td>" + ("{0:.1f}".format(Blame.get_stability(entry[0], entry[1].rows, self.changes)) + "</td>")