about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorLukas Fleischer2013-03-05 15:42:14 +0100
committerJason A. Donenfeld2013-03-20 21:08:32 +0100
commitef8a97d9c6983e4fc3710bdbe771edd4e3550dba (patch)
tree548ea4fda8fd0ed467895de2629ea3ea587143a1
parenthtml: check return value of write (diff)
downloadcgit-ef8a97d9c6983e4fc3710bdbe771edd4e3550dba.tar.gz
cgit-ef8a97d9c6983e4fc3710bdbe771edd4e3550dba.zip
Fix colspan values
This fixes a couple of minor oversights in previous commits and adjusts
all cells using colspan to use the correct width.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
-rw-r--r--ui-log.c14
-rw-r--r--ui-refs.c4
-rw-r--r--ui-summary.c24
3 files changed, 28 insertions, 14 deletions
diff --git a/ui-log.c b/ui-log.c index 857c05c..954d3e1 100644 --- a/ui-log.c +++ b/ui-log.c
@@ -98,14 +98,14 @@ next:
98static void print_commit(struct commit *commit, struct rev_info *revs) 98static void print_commit(struct commit *commit, struct rev_info *revs)
99{ 99{
100 struct commitinfo *info; 100 struct commitinfo *info;
101 int cols = revs->graph ? 3 : 2; 101 int columns = revs->graph ? 4 : 3;
102 struct strbuf graphbuf = STRBUF_INIT; 102 struct strbuf graphbuf = STRBUF_INIT;
103 struct strbuf msgbuf = STRBUF_INIT; 103 struct strbuf msgbuf = STRBUF_INIT;
104 104
105 if (ctx.repo->enable_log_filecount) 105 if (ctx.repo->enable_log_filecount)
106 cols++; 106 columns++;
107 if (ctx.repo->enable_log_linecount) 107 if (ctx.repo->enable_log_linecount)
108 cols++; 108 columns++;
109 109
110 if (revs->graph) { 110 if (revs->graph) {
111 /* Advance graph until current commit */ 111 /* Advance graph until current commit */
@@ -113,7 +113,7 @@ static void print_commit(struct commit *commit, struct rev_info *revs)
113 /* Print graph segment in otherwise empty table row */ 113 /* Print graph segment in otherwise empty table row */
114 html("<tr class='nohover'><td class='commitgraph'>"); 114 html("<tr class='nohover'><td class='commitgraph'>");
115 html(graphbuf.buf); 115 html(graphbuf.buf);
116 htmlf("</td><td colspan='%d' /></tr>\n", cols); 116 htmlf("</td><td colspan='%d' /></tr>\n", columns);
117 strbuf_setlen(&graphbuf, 0); 117 strbuf_setlen(&graphbuf, 0);
118 } 118 }
119 /* Current commit's graph segment is now ready in graphbuf */ 119 /* Current commit's graph segment is now ready in graphbuf */
@@ -232,7 +232,7 @@ static void print_commit(struct commit *commit, struct rev_info *revs)
232 html("<td/>"); /* Empty 'Age' column */ 232 html("<td/>"); /* Empty 'Age' column */
233 233
234 /* Print msgbuf into remainder of table row */ 234 /* Print msgbuf into remainder of table row */
235 htmlf("<td colspan='%d'%s>\n", cols, 235 htmlf("<td colspan='%d'%s>\n", columns - (revs->graph ? 1 : 0),
236 ctx.qry.showmsg ? " class='logmsg'" : ""); 236 ctx.qry.showmsg ? " class='logmsg'" : "");
237 html_txt(msgbuf.buf); 237 html_txt(msgbuf.buf);
238 html("</td></tr>\n"); 238 html("</td></tr>\n");
@@ -283,7 +283,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
283 struct rev_info rev; 283 struct rev_info rev;
284 struct commit *commit; 284 struct commit *commit;
285 struct vector vec = VECTOR_INIT(char *); 285 struct vector vec = VECTOR_INIT(char *);
286 int i, columns = 3; 286 int i, columns = commit_graph ? 4 : 3;
287 char *arg; 287 char *arg;
288 288
289 /* First argv is NULL */ 289 /* First argv is NULL */
@@ -421,7 +421,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
421 } 421 }
422 html("</div>"); 422 html("</div>");
423 } else if ((commit = get_revision(&rev)) != NULL) { 423 } else if ((commit = get_revision(&rev)) != NULL) {
424 html("<tr class='nohover'><td colspan='3'>"); 424 htmlf("<tr class='nohover'><td colspan='%d'>", columns);
425 cgit_log_link("[...]", NULL, NULL, ctx.qry.head, NULL, 425 cgit_log_link("[...]", NULL, NULL, ctx.qry.head, NULL,
426 ctx.qry.vpath, 0, NULL, NULL, ctx.qry.showmsg); 426 ctx.qry.vpath, 0, NULL, NULL, ctx.qry.showmsg);
427 html("</td></tr>\n"); 427 html("</td></tr>\n");
diff --git a/ui-refs.c b/ui-refs.c index e89f836..45db2ac 100644 --- a/ui-refs.c +++ b/ui-refs.c
@@ -177,7 +177,7 @@ static int print_tag(struct refinfo *ref)
177 177
178static void print_refs_link(char *path) 178static void print_refs_link(char *path)
179{ 179{
180 html("<tr class='nohover'><td colspan='4'>"); 180 html("<tr class='nohover'><td colspan='5'>");
181 cgit_refs_link("[...]", NULL, NULL, ctx.qry.head, NULL, path); 181 cgit_refs_link("[...]", NULL, NULL, ctx.qry.head, NULL, path);
182 html("</td></tr>"); 182 html("</td></tr>");
183} 183}
@@ -252,7 +252,7 @@ void cgit_print_refs()
252 cgit_print_tags(0); 252 cgit_print_tags(0);
253 else { 253 else {
254 cgit_print_branches(0); 254 cgit_print_branches(0);
255 html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>"); 255 html("<tr class='nohover'><td colspan='5'>&nbsp;</td></tr>");
256 cgit_print_tags(0); 256 cgit_print_tags(0);
257 } 257 }
258 html("</table>"); 258 html("</table>");
diff --git a/ui-summary.c b/ui-summary.c index b4fdd57..38639ce 100644 --- a/ui-summary.c +++ b/ui-summary.c
@@ -17,15 +17,22 @@ int urls = 0;
17 17
18static void print_url(char *base, char *suffix) 18static void print_url(char *base, char *suffix)
19{ 19{
20 int columns = 3;
21
22 if (ctx.repo->enable_log_filecount)
23 columns++;
24 if (ctx.repo->enable_log_linecount)
25 columns++;
26
20 if (!base || !*base) 27 if (!base || !*base)
21 return; 28 return;
22 if (urls++ == 0) { 29 if (urls++ == 0) {
23 html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>"); 30 htmlf("<tr class='nohover'><td colspan='%d'>&nbsp;</td></tr>", columns);
24 html("<tr><th class='left' colspan='4'>Clone</th></tr>\n"); 31 htmlf("<tr><th class='left' colspan='%d'>Clone</th></tr>\n", columns);
25 } 32 }
26 if (suffix && *suffix) 33 if (suffix && *suffix)
27 base = fmt("%s/%s", base, suffix); 34 base = fmt("%s/%s", base, suffix);
28 html("<tr><td colspan='4'><a href='"); 35 htmlf("<tr><td colspan='%d'><a href='", columns);
29 html_url_path(base); 36 html_url_path(base);
30 html("'>"); 37 html("'>");
31 html_txt(base); 38 html_txt(base);
@@ -52,12 +59,19 @@ static void print_urls(char *txt, char *suffix)
52 59
53void cgit_print_summary() 60void cgit_print_summary()
54{ 61{
62 int columns = 3;
63
64 if (ctx.repo->enable_log_filecount)
65 columns++;
66 if (ctx.repo->enable_log_linecount)
67 columns++;
68
55 html("<table summary='repository info' class='list nowrap'>"); 69 html("<table summary='repository info' class='list nowrap'>");
56 cgit_print_branches(ctx.cfg.summary_branches); 70 cgit_print_branches(ctx.cfg.summary_branches);
57 html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>"); 71 htmlf("<tr class='nohover'><td colspan='%d'>&nbsp;</td></tr>", columns);
58 cgit_print_tags(ctx.cfg.summary_tags); 72 cgit_print_tags(ctx.cfg.summary_tags);
59 if (ctx.cfg.summary_log > 0) { 73 if (ctx.cfg.summary_log > 0) {
60 html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>"); 74 htmlf("<tr class='nohover'><td colspan='%d'>&nbsp;</td></tr>", columns);
61 cgit_print_log(ctx.qry.head, 0, ctx.cfg.summary_log, NULL, 75 cgit_print_log(ctx.qry.head, 0, ctx.cfg.summary_log, NULL,
62 NULL, NULL, 0, 0, 0); 76 NULL, NULL, 0, 0, 0);
63 } 77 }