-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | add.png | bin | 168 -> 0 bytes | |||
-rw-r--r-- | cgit.css | 21 | ||||
-rw-r--r-- | del.png | bin | 168 -> 0 bytes | |||
-rw-r--r-- | ui-commit.c | 20 |
5 files changed, 27 insertions, 15 deletions
@@ -51,25 +51,24 @@ $(OBJECTS): cgit.h git/libgit.a git/libgit.a: $(INITGIT) $(MAKE) -C git # # phony targets # install: all clean-cache mkdir -p $(prefix) install cgit $(prefix)/$(CGIT_SCRIPT_NAME) install cgit.css $(prefix)/cgit.css - install add.png del.png $(prefix)/ clean-cgit: rm -f cgit *.o distclean-cgit: clean-cgit git clean -d -x clean-sub: $(MAKE) -C git clean distclean-sub: clean-sub $(shell cd git && git clean -d -x) diff --git a/add.png b/add.png Binary files differdeleted file mode 100644 index c550388..0000000 --- a/add.png +++ b/dev/null @@ -275,27 +275,44 @@ table.diffstat td.del a { color: red; } table.diffstat td.upd a { color: blue; } table.diffstat td.graph { width: 75%; vertical-align: center; } -table.diffstat td.graph img { +table.diffstat td.graph table { border: none; - height: 8pt; +} + +table.diffstat td.graph td { + padding: 0px; + border: 0px; + height: 7pt; +} + +table.diffstat td.graph td.add { + background-color: #5c5; +} + +table.diffstat td.graph td.rem { + background-color: #c55; +} + +table.diffstat td.graph td.none { + background-color: none; } div.diffstat-summary { color: #888; padding-top: 0.5em; } table.diff td { font-family: monospace; white-space: pre; } diff --git a/del.png b/del.png Binary files differdeleted file mode 100644 index 5c73e82..0000000 --- a/del.png +++ b/dev/null diff --git a/ui-commit.c b/ui-commit.c index b6a106f..8011dfc 100644 --- a/ui-commit.c +++ b/ui-commit.c @@ -20,25 +20,24 @@ static struct fileinfo { unsigned short new_mode; char *old_path; char *new_path; unsigned int added; unsigned int removed; } *items; void print_fileinfo(struct fileinfo *info) { char *query, *query2; char *class; - double width; switch (info->status) { case DIFF_STATUS_ADDED: class = "add"; break; case DIFF_STATUS_COPIED: class = "cpy"; break; case DIFF_STATUS_DELETED: class = "del"; break; case DIFF_STATUS_MODIFIED: @@ -87,36 +86,33 @@ void print_fileinfo(struct fileinfo *info) "copied" : "renamed"); query2 = fmt("id=%s", sha1_to_hex(info->old_sha1)); html_link_open(cgit_pageurl(cgit_query_repo, "view", query2), NULL, NULL); html_txt(info->old_path); html("</a>)"); } else { html_txt(info->new_path); html("</a>"); } html("</td><td class='right'>"); htmlf("%d", info->added + info->removed); - html("</td><td class='graph'>"); - width = (info->added + info->removed) * 100.0 / max_changes; - if (width < 0.1) - width = 0.1; - html_link_open(cgit_pageurl(cgit_query_repo, "diff", query), - NULL, NULL); - htmlf("<img src='/cgit/add.png' style='width: %.1f%%;'/>", - info->added * width / (info->added + info->removed)); - htmlf("<img src='/cgit/del.png' style='width: %.1f%%;'/>", - info->removed * width / (info->added + info->removed)); - html("</a></td></tr>\n"); + htmlf("<table width='%d%%'><tr>", (max_changes > 100 ? 100 : max_changes)); + htmlf("<td class='add' style='width: %.1f%%;'/>", + info->added * 100.0 / max_changes); + htmlf("<td class='rem' style='width: %.1f%%;'/>", + info->removed * 100.0 / max_changes); + htmlf("<td class='none' style='width: %.1f%%;'/>", + (max_changes - info->removed - info->added) * 100.0 / max_changes); + html("</tr></table></a></td></tr>\n"); } void cgit_count_diff_lines(char *line, int len) { if (line && (len > 0)) { if (line[0] == '+') lines_added++; else if (line[0] == '-') lines_removed++; } } |