diff options
author | Lars Hjemli <hjemli@gmail.com> | 2007-05-15 09:13:11 (JST) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-05-15 16:09:42 (JST) |
commit | e903011c4457c24c0095f270ca5e78c40729434f (patch) | |
tree | 255f128dfaf81f2fd03bb2216039bbf8f38ef167 /ui-commit.c | |
parent | cfd2aa079770ddb4c93d5995b2cd7b5f25da3681 (diff) | |
download | cgit-e903011c4457c24c0095f270ca5e78c40729434f.zip cgit-e903011c4457c24c0095f270ca5e78c40729434f.tar.gz |
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')
-rw-r--r-- | ui-commit.c | 20 |
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 | |||
@@ -29,7 +29,6 @@ void print_fileinfo(struct fileinfo *info) | |||
29 | { | 29 | { |
30 | char *query, *query2; | 30 | char *query, *query2; |
31 | char *class; | 31 | char *class; |
32 | double width; | ||
33 | 32 | ||
34 | switch (info->status) { | 33 | switch (info->status) { |
35 | case DIFF_STATUS_ADDED: | 34 | case DIFF_STATUS_ADDED: |
@@ -96,18 +95,15 @@ void print_fileinfo(struct fileinfo *info) | |||
96 | } | 95 | } |
97 | html("</td><td class='right'>"); | 96 | html("</td><td class='right'>"); |
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 | } |
112 | 108 | ||
113 | void cgit_count_diff_lines(char *line, int len) | 109 | void cgit_count_diff_lines(char *line, int len) |