mirror of
https://github.com/ejwa/gitinspector.git
synced 2024-09-30 11:21:28 +02:00
Slightly reworked styling and added use of "table-striped" class (#28).
Most of the old CSS rules are currently commented out but left intact to serve as a reference during development. While this change completely breaks the HTML output, I'm considering this iteration a first test.
This commit is contained in:
parent
75f1924823
commit
4396e993e6
@ -16,17 +16,6 @@
|
|||||||
var MINOR_AUTHOR_PERCENTAGE = 1.00;
|
var MINOR_AUTHOR_PERCENTAGE = 1.00;
|
||||||
var isReversed = false;
|
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.
|
// Fix header and set it to the right width.
|
||||||
var remainingHeaderWidth = ($("div.logo").width() - 4) - ($("div.logo img").innerWidth() + 48)
|
var remainingHeaderWidth = ($("div.logo").width() - 4) - ($("div.logo img").innerWidth() + 48)
|
||||||
@ -46,25 +35,23 @@
|
|||||||
}}).hide();
|
}}).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({{
|
$("table#changes, table#blame").tablesorter({{
|
||||||
sortList: [[0,0]],
|
sortList: [[0,0]],
|
||||||
headers: {{
|
headers: {{
|
||||||
0: {{ sorter: "text" }}
|
0: {{ sorter: "text" }}
|
||||||
}}
|
}}
|
||||||
}}).bind("sortEnd", function() {{
|
|
||||||
$(this).find("tbody tr:visible").each(colorRows);
|
|
||||||
}});
|
}});
|
||||||
|
|
||||||
|
$("table#changes tbody tr td:last-child").filter(function() {{
|
||||||
|
return parseFloat(this.innerHTML) < MINOR_AUTHOR_PERCENTAGE;
|
||||||
|
}}).parent().each(function() {{
|
||||||
|
$(this).after("<tr></tr>").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();
|
||||||
@ -82,7 +69,7 @@
|
|||||||
$(this).append("<strong> ∨</strong>");
|
$(this).append("<strong> ∨</strong>");
|
||||||
}});
|
}});
|
||||||
|
|
||||||
$("table.git tfoot tr td:first-child").filter(function() {{
|
$("table#changes 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() {{
|
||||||
@ -93,20 +80,21 @@
|
|||||||
|
|
||||||
if (this.clicked) {{
|
if (this.clicked) {{
|
||||||
this.innerHTML = "{hide_minor_authors} (" + this.hiddenCount + ") ∧";
|
this.innerHTML = "{hide_minor_authors} (" + this.hiddenCount + ") ∧";
|
||||||
$(this).parent().parent().parent().find("tbody tr").show().each(colorRows);
|
$(this).parent().parent().parent().find("tbody tr:empty").remove();
|
||||||
|
$(this).parent().parent().parent().find("tbody tr").show();
|
||||||
}} else {{
|
}} else {{
|
||||||
this.innerHTML = "{show_minor_authors} (" + this.hiddenCount + ") ∨";
|
this.innerHTML = "{show_minor_authors} (" + this.hiddenCount + ") ∨";
|
||||||
$(this).parent().parent().parent().find("tbody tr td:last-child").filter(function() {{
|
$(this).parent().parent().parent().find("tbody tr td:last-child").filter(function() {{
|
||||||
return parseFloat(this.innerHTML) < MINOR_AUTHOR_PERCENTAGE;
|
return parseFloat(this.innerHTML) < MINOR_AUTHOR_PERCENTAGE;
|
||||||
}}).parent().hide();
|
}}).parent().each(function() {{
|
||||||
$("table.git tbody tr:visible").each(colorRows);
|
$(this).after("<tr></tr>").hide();
|
||||||
|
}}).hide();
|
||||||
}}
|
}}
|
||||||
}});
|
}});
|
||||||
|
|
||||||
filterResponsibilities();
|
filterResponsibilities();
|
||||||
var hiddenResponsibilitiesCount = $("div#responsibilities div h3:hidden").length;
|
var hiddenResponsibilitiesCount = $("div#responsibilities div h3:hidden").length;
|
||||||
if (hiddenResponsibilitiesCount > 0) {{
|
if (hiddenResponsibilitiesCount > 0) {{
|
||||||
$("div#responsibilities div h3:visible").each(colorRows);
|
|
||||||
$("div#responsibilities").prepend("<div class=\"button\">{show_minor_authors} (" + hiddenResponsibilitiesCount + ") ∨</div>");
|
$("div#responsibilities").prepend("<div class=\"button\">{show_minor_authors} (" + hiddenResponsibilitiesCount + ") ∨</div>");
|
||||||
|
|
||||||
$("div#responsibilities div.button").click(function() {{
|
$("div#responsibilities div.button").click(function() {{
|
||||||
@ -125,7 +113,6 @@
|
|||||||
filterTimeLine();
|
filterTimeLine();
|
||||||
var hiddenTimelineCount = $("div#timeline table.git tbody tr:hidden").length;
|
var hiddenTimelineCount = $("div#timeline table.git tbody tr:hidden").length;
|
||||||
if (hiddenTimelineCount > 0) {{
|
if (hiddenTimelineCount > 0) {{
|
||||||
$("div#timeline table.git tbody tr:visible").each(colorRows);
|
|
||||||
$("div#timeline").prepend("<div class=\"button\">{show_minor_rows} (" + hiddenTimelineCount + ") ∨</div>");
|
$("div#timeline").prepend("<div class=\"button\">{show_minor_rows} (" + hiddenTimelineCount + ") ∨</div>");
|
||||||
|
|
||||||
$("div#timeline div.button").click(function() {{
|
$("div#timeline div.button").click(function() {{
|
||||||
@ -136,7 +123,6 @@
|
|||||||
}} else {{
|
}} else {{
|
||||||
this.innerHTML = "{show_minor_rows} (" + hiddenTimelineCount + ") ∨";
|
this.innerHTML = "{show_minor_rows} (" + hiddenTimelineCount + ") ∨";
|
||||||
filterTimeLine();
|
filterTimeLine();
|
||||||
$("div#timeline table.git tbody tr:visible").each(colorRows);
|
|
||||||
}}
|
}}
|
||||||
}});
|
}});
|
||||||
}}
|
}}
|
||||||
@ -208,39 +194,68 @@
|
|||||||
</script>
|
</script>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
body {{
|
body {{
|
||||||
background: -webkit-linear-gradient(left, #8f8a9a, #dad2d7, #8f8a9a);
|
background: -webkit-linear-gradient(left, #afbaba, #eae2e7, #afbaba);
|
||||||
background: -moz-linear-gradient(left, #8f8a9a, #dad2d7, #8f8a9a);
|
background: -moz-linear-gradient(left, #afbaba, #eae2e7, #afbaba);
|
||||||
}}
|
}}
|
||||||
html, body {{
|
html, body {{
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-family: "Arial";
|
font-family: "Arial";
|
||||||
}}
|
}}
|
||||||
body > div {{
|
|
||||||
margin: 0 auto;
|
|
||||||
width: 58em;
|
|
||||||
}}
|
|
||||||
div.box {{
|
div.box {{
|
||||||
border: 4px solid #ddd;
|
border: 6px solid #e7e7e7;
|
||||||
background-color: #eee;
|
background-color: #f4f4f4;
|
||||||
margin: 0.75em;
|
margin: 2em;
|
||||||
padding: 5px;
|
padding: 1em;
|
||||||
font-size: small;
|
font-size: small;
|
||||||
border-radius: 15px;
|
border-radius: 10px;
|
||||||
-moz-border-radius: 15px;
|
-moz-border-radius: 10px;
|
||||||
box-shadow: 1px 1px 3px #666;
|
box-shadow: 1px 1px 3px #666;
|
||||||
-moz-box-shadow: 1px 1px 3px #666;
|
-moz-box-shadow: 1px 1px 3px #666;
|
||||||
}}
|
}}
|
||||||
div.logo p {{
|
div.logo p {{
|
||||||
width: 60em;
|
margin: 0;
|
||||||
display:inline-block;
|
padding: 15px 0 0 0;
|
||||||
vertical-align:middle;
|
|
||||||
}}
|
}}
|
||||||
div.logo img {{
|
div.logo img {{
|
||||||
vertical-align:middle;
|
float: left;
|
||||||
padding: 2px 10px 2px 2px;
|
padding: 0px 1em 0px 0px;
|
||||||
}}
|
}}
|
||||||
body > div {{
|
table {{
|
||||||
display: block-inline;
|
font-size: small;
|
||||||
|
}}
|
||||||
|
table.table > thead > tr > th, table.table > tbody > tr > td {{
|
||||||
|
border: 1px solid #efefef;
|
||||||
|
vertical-align: middle;
|
||||||
|
padding: 6px;
|
||||||
|
}}
|
||||||
|
thead tr th.header {{
|
||||||
|
background-color: #e7b7a5;
|
||||||
|
}}
|
||||||
|
|
||||||
|
th:first-child {{
|
||||||
|
border-top-left-radius: 10px;
|
||||||
|
}}
|
||||||
|
th:last-child {{
|
||||||
|
border-top-right-radius: 10px;
|
||||||
|
}}
|
||||||
|
td img, h3 img {{
|
||||||
|
border-radius: 14px;
|
||||||
|
-moz-border-radius: 14px;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-right: 0.5em;
|
||||||
|
opacity: 0.85;
|
||||||
|
}}
|
||||||
|
h1 {{
|
||||||
|
font-size: 18px;
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 10px;
|
||||||
|
}}
|
||||||
|
hr {{
|
||||||
|
border: 3px solid #e7e7e7;
|
||||||
|
}}
|
||||||
|
/*body > div {{
|
||||||
|
width: 100%;
|
||||||
|
display: inline-block;
|
||||||
}}
|
}}
|
||||||
body > div > div > div {{
|
body > div > div > div {{
|
||||||
position: relative;
|
position: relative;
|
||||||
@ -359,11 +374,11 @@
|
|||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
background-color: #ddcece;
|
background-color: #ddcece;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
}}
|
}}*/
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div><div class="box logo">
|
<div><div class="row box logo">
|
||||||
<a href="https://github.com/ejwa/gitinspector"><img src="data:image/png;base64,{logo}" /></a>
|
<a href="https://github.com/ejwa/gitinspector"><img src="data:image/png;base64,{logo}" /></a>
|
||||||
<p>{repo_text}<br>{logo_text}</p>
|
<p>{repo_text}<br>{logo_text}</p>
|
||||||
</div></div>
|
</div></div>
|
||||||
|
@ -41,7 +41,7 @@ class BlameOutput(Outputable):
|
|||||||
|
|
||||||
def output_html(self):
|
def output_html(self):
|
||||||
blame_xml = "<div><div class=\"box\">"
|
blame_xml = "<div><div class=\"box\">"
|
||||||
blame_xml += "<p>" + _(BLAME_INFO_TEXT) + ".</p><div><table id=\"blame\" class=\"git\">"
|
blame_xml += "<h1>" + _(BLAME_INFO_TEXT) + "</h1><hr /><div><table id=\"blame\" class=\"table table-striped\">"
|
||||||
blame_xml += "<thead><tr> <th>{0}</th> <th>{1}</th> <th>{2}</th> <th>{3}</th> <th>{4}</th> </tr></thead>".format(
|
blame_xml += "<thead><tr> <th>{0}</th> <th>{1}</th> <th>{2}</th> <th>{3}</th> <th>{4}</th> </tr></thead>".format(
|
||||||
_("Author"), _("Rows"), _("Stability"), _("Age"), _("% in comments"))
|
_("Author"), _("Rows"), _("Stability"), _("Age"), _("% in comments"))
|
||||||
blame_xml += "<tbody>"
|
blame_xml += "<tbody>"
|
||||||
|
@ -44,7 +44,7 @@ class ChangesOutput(Outputable):
|
|||||||
total_changes += authorinfo_list.get(i).deletions
|
total_changes += authorinfo_list.get(i).deletions
|
||||||
|
|
||||||
if authorinfo_list:
|
if authorinfo_list:
|
||||||
changes_xml += "<p>" + _(HISTORICAL_INFO_TEXT) + ".</p><div><table id=\"changes\" class=\"git\">"
|
changes_xml += "<h1>" + _(HISTORICAL_INFO_TEXT) + "</h1><hr /><div><table id=\"changes\" class=\"table table-striped\">"
|
||||||
changes_xml += "<thead><tr> <th>{0}</th> <th>{1}</th> <th>{2}</th> <th>{3}</th> <th>{4}</th>".format(
|
changes_xml += "<thead><tr> <th>{0}</th> <th>{1}</th> <th>{2}</th> <th>{3}</th> <th>{4}</th>".format(
|
||||||
_("Author"), _("Commits"), _("Insertions"), _("Deletions"), _("% of changes"))
|
_("Author"), _("Commits"), _("Insertions"), _("Deletions"), _("% of changes"))
|
||||||
changes_xml += "</tr></thead><tbody>"
|
changes_xml += "</tr></thead><tbody>"
|
||||||
@ -52,8 +52,7 @@ class ChangesOutput(Outputable):
|
|||||||
for i, entry in enumerate(sorted(authorinfo_list)):
|
for i, entry in enumerate(sorted(authorinfo_list)):
|
||||||
authorinfo = authorinfo_list.get(entry)
|
authorinfo = authorinfo_list.get(entry)
|
||||||
percentage = 0 if total_changes == 0 else (authorinfo.insertions + authorinfo.deletions) / total_changes * 100
|
percentage = 0 if total_changes == 0 else (authorinfo.insertions + authorinfo.deletions) / total_changes * 100
|
||||||
|
changes_xml += "<tr>"
|
||||||
changes_xml += "<tr " + ("class=\"odd\">" if i % 2 == 1 else ">")
|
|
||||||
|
|
||||||
if format.get_selected() == "html":
|
if format.get_selected() == "html":
|
||||||
changes_xml += "<td><img src=\"{0}\"/>{1}</td>".format(
|
changes_xml += "<td><img src=\"{0}\"/>{1}</td>".format(
|
||||||
@ -90,7 +89,7 @@ class ChangesOutput(Outputable):
|
|||||||
changes_xml += " });"
|
changes_xml += " });"
|
||||||
changes_xml += "</script>"
|
changes_xml += "</script>"
|
||||||
else:
|
else:
|
||||||
changes_xml += "<p>" + _(NO_COMMITED_FILES_TEXT) + ".</p>"
|
changes_xml += "<h1>" + _(NO_COMMITED_FILES_TEXT) + "</h1>"
|
||||||
|
|
||||||
changes_xml += "</div></div>"
|
changes_xml += "</div></div>"
|
||||||
print(changes_xml)
|
print(changes_xml)
|
||||||
|
Loading…
Reference in New Issue
Block a user