summaryrefslogtreecommitdiffabout
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
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 (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile1
-rw-r--r--add.pngbin168 -> 0 bytes
-rw-r--r--cgit.css21
-rw-r--r--del.pngbin168 -> 0 bytes
-rw-r--r--ui-commit.c20
5 files changed, 27 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index 96d68cb..aa7146d 100644
--- a/Makefile
+++ b/Makefile
@@ -60,7 +60,6 @@ install: all clean-cache
60 mkdir -p $(prefix) 60 mkdir -p $(prefix)
61 install cgit $(prefix)/$(CGIT_SCRIPT_NAME) 61 install cgit $(prefix)/$(CGIT_SCRIPT_NAME)
62 install cgit.css $(prefix)/cgit.css 62 install cgit.css $(prefix)/cgit.css
63 install add.png del.png $(prefix)/
64 63
65clean-cgit: 64clean-cgit:
66 rm -f cgit *.o 65 rm -f cgit *.o
diff --git a/add.png b/add.png
deleted file mode 100644
index c550388..0000000
--- a/add.png
+++ b/dev/null
Binary files differ
diff --git a/cgit.css b/cgit.css
index 53c93f2..87fd00a 100644
--- a/cgit.css
+++ b/cgit.css
@@ -284,9 +284,26 @@ table.diffstat td.graph {
284 vertical-align: center; 284 vertical-align: center;
285} 285}
286 286
287table.diffstat td.graph img { 287table.diffstat td.graph table {
288 border: none; 288 border: none;
289 height: 8pt; 289}
290
291table.diffstat td.graph td {
292 padding: 0px;
293 border: 0px;
294 height: 7pt;
295}
296
297table.diffstat td.graph td.add {
298 background-color: #5c5;
299}
300
301table.diffstat td.graph td.rem {
302 background-color: #c55;
303}
304
305table.diffstat td.graph td.none {
306 background-color: none;
290} 307}
291 308
292div.diffstat-summary { 309div.diffstat-summary {
diff --git a/del.png b/del.png
deleted file mode 100644
index 5c73e82..0000000
--- a/del.png
+++ b/dev/null
Binary files differ
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
113void cgit_count_diff_lines(char *line, int len) 109void cgit_count_diff_lines(char *line, int len)