Re-implement timeline in the HTML outpout (#28).

While the timeline itself is displayed just fine, filtering of minor
authors has not been re-added yet.
This commit is contained in:
Adam Waldenberg 2015-12-26 03:03:45 +01:00
parent 5a8e84cb2d
commit 7f74b6a99f
2 changed files with 28 additions and 6 deletions

View File

@ -227,6 +227,9 @@
table#changes tr.piehover, table#blame tr.piehover {{
background-color: #e7e8d8;
}}
table#timeline {{
margin-bottom: 15px;
}}
table.table > tbody > tr > td {{
border: 1px solid #e8e8e8;
}}
@ -234,7 +237,7 @@
vertical-align: middle;
padding: 8px 0px 8px 12px;
}}
thead tr th.header {{
thead tr th.header, tfoot tr td {{
background-color: #e7b7a5;
border-width: 0px;
}}
@ -320,6 +323,23 @@
div.legend > div, div.legend td.legendColorBox > div, div.legend td.legendColorBox > div > div {{
border-radius: 3px;
}}
div.insert {{
background-color: #8a8;
}}
div.remove {{
background-color: #c77;
}}
div.insert, div.remove {{
width: 5%;
height: 100%;
float: left;
padding: 0;
margin: 0
}}
table#timeline td.insertremove {{
padding-left: 12px;
padding-right: 12px;
}}
/*body > div {{
width: 100%;
display: inline-block;

View File

@ -60,17 +60,17 @@ def __output_row__text__(timeline_data, periods, names):
print("")
def __output_row__html__(timeline_data, periods, names):
timeline_xml = "<table class=\"git full\"><thead><tr><th>" + _("Author") + "</th>"
timeline_xml = "<table id=\"timeline\" class=\"table table-striped\"><thead><tr><th class=\"header\">" + _("Author") + "</th>"
for period in periods:
timeline_xml += "<th>" + str(period) + "</th>"
timeline_xml += "<th class=\"header\">" + str(period) + "</th>"
timeline_xml += "</tr></thead><tbody>"
i = 0
for name in names:
if timeline_data.is_author_in_periods(periods, name[0]):
timeline_xml += "<tr" + (" class=\"odd\">" if i % 2 == 1 else ">")
timeline_xml += "<tr>"
if format.get_selected() == "html":
timeline_xml += "<td><img src=\"{0}\"/>{1}</td>".format(gravatar.get_url(name[1]), name[0])
@ -78,11 +78,13 @@ def __output_row__html__(timeline_data, periods, names):
timeline_xml += "<td>" + name[0] + "</td>"
for period in periods:
multiplier = timeline_data.get_multiplier(period, 18)
multiplier = timeline_data.get_multiplier(period, 20)
signs = timeline_data.get_author_signs_in_period(name[0], period, multiplier)
signs_str = (signs[1] * "<div class=\"remove\">&nbsp;</div>" + signs[0] * "<div class=\"insert\">&nbsp;</div>")
timeline_xml += "<td>" + ("." if timeline_data.is_author_in_period(period, name[0]) and len(signs_str) == 0 else signs_str)
timeline_xml += "<td class=\"insertremove\">" + \
("." if timeline_data.is_author_in_period(period, name[0]) and
len(signs_str) == 0 else signs_str)
timeline_xml += "</td>"
timeline_xml += "</tr>"
i = i + 1