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
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) · 1 unmodified line
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) · 112 unmodified lines
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 · 44 unmodified lines
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 · 131 unmodified lines
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");
ui-refs.c+2−2
@@ -177,7 +177,7 @@ static int print_tag(struct refinfo *ref) · 176 unmodified lines
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() · 68 unmodified lines
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>");
ui-summary.c+19−5
@@ -17,15 +17,22 @@ int urls = 0; · 16 unmodified lines
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) · 20 unmodified lines
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 }