gitinspector/gitinspector/html/html.header

368 lines
11 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />
<title>{title}</title>
<script type="application/javascript"{jquery}</script>
<script type="application/javascript">{jquery_tablesorter}</script>
<script type="application/javascript">{jquery_flot}</script>
<script type="application/javascript">{jquery_flot_pie}</script>
<script type="application/javascript">{jquery_flot_resize}</script>
<script type="application/javascript">
$(document).ready(function() {{
var row = 0;
var MINOR_AUTHOR_PERCENTAGE = 1.00;
var isReversed = false;
var colorRows = function() {{
$(this).removeClass("odd");
if (row++ % 2 == 1) {{
$(this).addClass("odd");
}}
if(this == $(this).parent().find("tr:visible").get(-1)) {{
row = 0;
}}
}}
// Fix header and set it to the right width.
var remainingHeaderWidth = ($("div.logo").width() - 4) - ($("div.logo img").innerWidth() + 48)
$("div.logo p").css("width", remainingHeaderWidth);
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#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();
$("table.git tbody tr:visible").each(colorRows);
$("table#changes, table#blame").tablesorter({{
sortList: [[0,0]],
headers: {{
0: {{ sorter: "text" }}
}}
}}).bind("sortEnd", function() {{
$(this).find("tbody tr:visible").each(colorRows);
}});
$("table#changes thead tr th, table#blame thead tr th").click(function() {{
$(this).parent().find("th strong").remove();
var parentIndex = $(this).index();
if (this.isReversed) {{
$(this).append("<strong> &and;</strong>");
}} else {{
$(this).append("<strong> &or;</strong>");
}}
this.isReversed = !this.isReversed;
}});
$("table#changes thead tr th:first-child, table#blame thead tr th:first-child").each(function() {{
this.isReversed = true;
$(this).append("<strong> &or;</strong>");
}});
$("table.git tfoot tr td:first-child").filter(function() {{
this.hiddenCount = $(this).parent().parent().parent().find("tbody tr:hidden").length;
return this.hiddenCount > 0;
}}).each(function() {{
$(this).addClass("hoverable");
this.innerHTML = "{show_minor_authors} (" + this.hiddenCount + ") &or;";
}}).click(function() {{
this.clicked = !this.clicked;
if (this.clicked) {{
this.innerHTML = "{hide_minor_authors} (" + this.hiddenCount + ") &and;";
$(this).parent().parent().parent().find("tbody tr").show().each(colorRows);
}} else {{
this.innerHTML = "{show_minor_authors} (" + this.hiddenCount + ") &or;";
$(this).parent().parent().parent().find("tbody tr td:last-child").filter(function() {{
return parseFloat(this.innerHTML) < MINOR_AUTHOR_PERCENTAGE;
}}).parent().hide();
$("table.git tbody tr:visible").each(colorRows);
}}
}});
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").click(function() {{
this.clicked = !this.clicked;
if (this.clicked) {{
this.innerHTML = "{hide_minor_authors} (" + hiddenResponsibilitiesCount + ") &and;";
$("div#responsibilities div").show();
}} else {{
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);
$("div#timeline").prepend("<div class=\"button\">{show_minor_rows} (" + hiddenTimelineCount + ") &or;</div>");
$("div#timeline div.button").click(function() {{
this.clicked = !this.clicked;
if (this.clicked) {{
this.innerHTML = "{hide_minor_rows} (" + hiddenTimelineCount + ") &and;";
$("div#timeline table.git tbody tr").show().each(colorRows);
}} else {{
this.innerHTML = "{show_minor_rows} (" + hiddenTimelineCount + ") &or;";
filterTimeLine();
$("div#timeline table.git tbody tr:visible").each(colorRows);
}}
}});
}}
$("#blame_chart, #changes_chart").bind("plothover", function(event, pos, obj) {{
if (obj) {{
var selection = "table tbody tr td:contains(\"" + obj.series.label + "\")";
var element = $(this).parent().find(selection);
if (element) {{
if (this.hoveredElement && this.hoveredElement.html() != element.parent().html()) {{
this.hoveredElement.removeClass("piehover");
}}
element.parent().addClass("piehover");
this.hoveredElement = element.parent();
}}
}} else if (this.hoveredElement) {{
this.hoveredElement.removeClass("piehover");
}}
}});
// Make sure the two pie charts use the same colors.
var author_colors = {{}};
$.each(changes_plot.getData(), function(i, v) {{
author_colors[v["label"]] = v["color"];
}});
$.each(blame_plot.getData(), function(i, v) {{
if (author_colors[v["label"]] != undefined) {{
v["color"] = author_colors[v["label"]];
}}
}});
blame_plot.setupGrid();
blame_plot.draw();
// Color in metrics levels.
$("div#metrics div div").each(function() {{
var rgb = $(this).css("background-color").match(/\d+/g);
rgb[0] = parseInt(rgb[0]);
rgb[1] = parseInt(rgb[1]);
rgb[2] = parseInt(rgb[2]);
if ($(this).hasClass("minimal")) {{
rgb[0] -= 10;
rgb[1] += 10;
rgb[2] -= 10;
}} else if ($(this).hasClass("minor")) {{
rgb[1] += 10;
}} else if ($(this).hasClass("medium")) {{
rgb[0] += 10;
rgb[1] += 10;
}} else if ($(this).hasClass("bad")) {{
rgb[0] += 10;
rgb[1] -= 10;
rgb[2] -= 10;
}} else if ($(this).hasClass("severe")) {{
rgb[0] += 20;
rgb[1] -= 20;
rgb[2] -= 20;
}}
$(this).css("background-color", "rgb(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + ")");
}});
}});
</script>
<style type="text/css">
body {{
background: -webkit-linear-gradient(left, #8f8a9a, #dad2d7, #8f8a9a);
background: -moz-linear-gradient(left, #8f8a9a, #dad2d7, #8f8a9a);
}}
html, body {{
margin: 0;
font-family: "Arial";
}}
body > div {{
margin: 0 auto;
width: 58em;
}}
div.box {{
border: 4px solid #ddd;
background-color: #eee;
margin: 0.75em;
padding: 5px;
font-size: small;
border-radius: 15px;
-moz-border-radius: 15px;
box-shadow: 1px 1px 3px #666;
-moz-box-shadow: 1px 1px 3px #666;
}}
div.logo p {{
width: 60em;
display:inline-block;
vertical-align:middle;
}}
div.logo img {{
vertical-align:middle;
padding: 2px 10px 2px 2px;
}}
body > div {{
display: block-inline;
}}
body > div > div > div {{
position: relative;
width: 100%;
min-height: 140px;
}}
table.git {{
font-size: small;
width: 65%;
padding-right: 5px;
}}
table.full {{
width: 100%;
}}
table.git th, table.git tfoot tr td {{
padding: 0.3em;
background-color: #ddcece;
border-radius: 8px 8px 0px 0px;
-moz-border-radius: 8px 8px 0px 0px;
}}
table#changes thead tr th, table#blame thead tr th, table.git tfoot tr td {{
border: 1px solid #eee;
text-align: center;
}}
table.git tfoot tr td {{
border-radius: 0px 0px 8px 8px;
-moz-border-radius: 0px 0px 8px 8px;
text-align: center;
}}
table.git td, table.git th, table#timeline td, table#timeline th {{
padding: 0.35em;
height: 2em;
}}
table.git td div.insert {{
background-color: #7a7;
}}
table.git td div.remove {{
background-color: #c66;
}}
table.git td div.insert, table.git td div.remove {{
height: 100%;
float: left;
}}
table.git tr.odd {{
background-color: #dbdbdb;
}}
table.git tr.piehover {{
background-color: #dddece;
}}
div.chart {{
position: absolute;
top: 5px;
bottom: 5px;
right: 0px;
width: 35%;
min-height: 100px;
max-height: 210px;
font-size: x-small;
}}
p.error {{
color: #700;
}}
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, div#responsibilities div.button:hover {{
background-color: #eddede;
border: 1px solid #bbb;
cursor: hand;
}}
div#responsibilities div, div#responsibilities div div, div#metrics div, div#metrics div div {{
min-height: 0px;
padding: 0.5em 0.2em;
width: auto;
}}
div#metrics div {{
background-color: #eee;
}}
div#responsibilities div.odd, div#metrics div.odd {{
background-color: #dbdbdb;
}}
div#responsibilities p {{
margin-bottom: 0px;
}}
td img, h3 img {{
border-radius: 3px 3px 3px 3px;
-moz-border-radius: 3px 3px 3px 3px;
vertical-align: middle;
margin-right: 0.4em;
opacity: 0.85;
}}
td img {{
width: 20px;
height: 20px;
}}
h3 img {{
width: 32px;
height: 32px;
}}
h3, h4 {{
border-radius: 8px 8px 8px 8px;
-moz-border-radius: 8px 8px 8px 8px;
background-color: #ddcece;
margin-bottom: 0.2em;
margin-top: 0.6em;
}}
h4 {{
margin-top: 0.2em;
padding: 0.5em;
}}
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>
<div><div class="box logo">
<img src="data:image/png;base64,{logo}" />
<p>{repo_text}<br>{logo_text}</p>
</div></div>