summaryrefslogtreecommitdiffabout
path: root/ui-commit.c
authorLars Hjemli <hjemli@gmail.com>2007-05-15 00:13:11 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2007-05-15 07:09:42 (UTC)
commite903011c4457c24c0095f270ca5e78c40729434f (patch) (unidiff)
tree255f128dfaf81f2fd03bb2216039bbf8f38ef167 /ui-commit.c
parentcfd2aa079770ddb4c93d5995b2cd7b5f25da3681 (diff)
downloadcgit-e903011c4457c24c0095f270ca5e78c40729434f.zip
cgit-e903011c4457c24c0095f270ca5e78c40729434f.tar.gz
cgit-e903011c4457c24c0095f270ca5e78c40729434f.tar.bz2
Use tables and css to create the diffstat graph, fix scaling
There was no need to use image-files for the graphs, so lets drop them. At the same time, fix scaling of the graphs so that the full width is used only if atleast 100 LOC are changed in one of the files. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'ui-commit.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-commit.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/ui-commit.c b/ui-commit.c
index b6a106f..8011dfc 100644
--- a/ui-commit.c
+++ b/ui-commit.c
@@ -31,3 +31,2 @@ void print_fileinfo(struct fileinfo *info)
31 char *class; 31 char *class;
32 double width;
33 32
@@ -98,14 +97,11 @@ void print_fileinfo(struct fileinfo *info)
98 htmlf("%d", info->added + info->removed); 97 htmlf("%d", info->added + info->removed);
99
100 html("</td><td class='graph'>"); 98 html("</td><td class='graph'>");
101 width = (info->added + info->removed) * 100.0 / max_changes; 99 htmlf("<table width='%d%%'><tr>", (max_changes > 100 ? 100 : max_changes));
102 if (width < 0.1) 100 htmlf("<td class='add' style='width: %.1f%%;'/>",
103 width = 0.1; 101 info->added * 100.0 / max_changes);
104 html_link_open(cgit_pageurl(cgit_query_repo, "diff", query), 102 htmlf("<td class='rem' style='width: %.1f%%;'/>",
105 NULL, NULL); 103 info->removed * 100.0 / max_changes);
106 htmlf("<img src='/cgit/add.png' style='width: %.1f%%;'/>", 104 htmlf("<td class='none' style='width: %.1f%%;'/>",
107 info->added * width / (info->added + info->removed)); 105 (max_changes - info->removed - info->added) * 100.0 / max_changes);
108 htmlf("<img src='/cgit/del.png' style='width: %.1f%%;'/>", 106 html("</tr></table></a></td></tr>\n");
109 info->removed * width / (info->added + info->removed));
110 html("</a></td></tr>\n");
111} 107}