History

Fix colspan values

This fixes a couple of minor oversights in previous commits and adjusts all cells using colspan to use the correct width.

Lukas Fleischer committed 13 years ago

Commit ef8a97d1 parent 6d7e3593 files · +28 −14Browse files

Unified · Split

3 files
  1. ui-log.c +7 −7
  2. ui-refs.c +2 −2
  3. ui-summary.c +19 −5
ui-log.c+7−7
@@ -98,14 +98,14 @@ next: · 97 unmodified lines
9898 static void print_commit(struct commit *commit, struct rev_info *revs)
9999 {
100100 struct commitinfo *info;
101− int cols = revs->graph ? 3 : 2;
101+ int columns = revs->graph ? 4 : 3;
102102 struct strbuf graphbuf = STRBUF_INIT;
103103 struct strbuf msgbuf = STRBUF_INIT;
104104
105105 if (ctx.repo->enable_log_filecount)
106− cols++;
106+ columns++;
107107 if (ctx.repo->enable_log_linecount)
108− cols++;
108+ columns++;
109109
110110 if (revs->graph) {
111111 /* Advance graph until current commit */
@@ -113,7 +113,7 @@ static void print_commit(struct commit *commit, struct rev_info *revs) · 1 unmodified line
113113 /* Print graph segment in otherwise empty table row */
114114 html("<tr class='nohover'><td class='commitgraph'>");
115115 html(graphbuf.buf);
116− htmlf("</td><td colspan='%d' /></tr>\n", cols);
116+ htmlf("</td><td colspan='%d' /></tr>\n", columns);
117117 strbuf_setlen(&graphbuf, 0);
118118 }
119119 /* 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) · 112 unmodified lines
232232 html("<td/>"); /* Empty 'Age' column */
233233
234234 /* 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),
236236 ctx.qry.showmsg ? " class='logmsg'" : "");
237237 html_txt(msgbuf.buf);
238238 html("</td></tr>\n");
@@ -283,7 +283,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern · 44 unmodified lines
283283 struct rev_info rev;
284284 struct commit *commit;
285285 struct vector vec = VECTOR_INIT(char *);
286− int i, columns = 3;
286+ int i, columns = commit_graph ? 4 : 3;
287287 char *arg;
288288
289289 /* First argv is NULL */
@@ -421,7 +421,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern · 131 unmodified lines
421421 }
422422 html("</div>");
423423 } else if ((commit = get_revision(&rev)) != NULL) {
424− html("<tr class='nohover'><td colspan='3'>");
424+ htmlf("<tr class='nohover'><td colspan='%d'>", columns);
425425 cgit_log_link("[...]", NULL, NULL, ctx.qry.head, NULL,
426426 ctx.qry.vpath, 0, NULL, NULL, ctx.qry.showmsg);
427427 html("</td></tr>\n");
ui-refs.c+2−2
@@ -177,7 +177,7 @@ static int print_tag(struct refinfo *ref) · 176 unmodified lines
177177
178178 static void print_refs_link(char *path)
179179 {
180− html("<tr class='nohover'><td colspan='4'>");
180+ html("<tr class='nohover'><td colspan='5'>");
181181 cgit_refs_link("[...]", NULL, NULL, ctx.qry.head, NULL, path);
182182 html("</td></tr>");
183183 }
@@ -252,7 +252,7 @@ void cgit_print_refs() · 68 unmodified lines
252252 cgit_print_tags(0);
253253 else {
254254 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>");
256256 cgit_print_tags(0);
257257 }
258258 html("</table>");
ui-summary.c+19−5
@@ -17,15 +17,22 @@ int urls = 0; · 16 unmodified lines
1717
1818 static void print_url(char *base, char *suffix)
1919 {
20+ int columns = 3;
21+
22+ if (ctx.repo->enable_log_filecount)
23+ columns++;
24+ if (ctx.repo->enable_log_linecount)
25+ columns++;
26+
2027 if (!base || !*base)
2128 return;
2229 if (urls++ == 0) {
23− html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>");
24− html("<tr><th class='left' colspan='4'>Clone</th></tr>\n");
30+ htmlf("<tr class='nohover'><td colspan='%d'>&nbsp;</td></tr>", columns);
31+ htmlf("<tr><th class='left' colspan='%d'>Clone</th></tr>\n", columns);
2532 }
2633 if (suffix && *suffix)
2734 base = fmt("%s/%s", base, suffix);
28− html("<tr><td colspan='4'><a href='");
35+ htmlf("<tr><td colspan='%d'><a href='", columns);
2936 html_url_path(base);
3037 html("'>");
3138 html_txt(base);
@@ -52,12 +59,19 @@ static void print_urls(char *txt, char *suffix) · 20 unmodified lines
5259
5360 void cgit_print_summary()
5461 {
62+ int columns = 3;
63+
64+ if (ctx.repo->enable_log_filecount)
65+ columns++;
66+ if (ctx.repo->enable_log_linecount)
67+ columns++;
68+
5569 html("<table summary='repository info' class='list nowrap'>");
5670 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);
5872 cgit_print_tags(ctx.cfg.summary_tags);
5973 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);
6175 cgit_print_log(ctx.qry.head, 0, ctx.cfg.summary_log, NULL,
6276 NULL, NULL, 0, 0, 0);
6377 }