diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Give every summary section the same columns
The ref rows always spanned five columns and the log three to five, so
with the default config the log and clone rows stopped 160px short of
the table's edge, and with any config the log rows did on a phone,
where they alone lost their counts. A column no cell began in also
made the summary and refs pages invalid HTML.
Diffstat (limited to 'source/ui-summary.c')
| -rw-r--r-- | source/ui-summary.c | 25 |
1 file changed, 19 insertions, 6 deletions
diff --git a/source/ui-summary.c b/source/ui-summary.c index 005263a..f37650d 100644 --- a/source/ui-summary.c +++ b/source/ui-summary.c @@ -18,8 +18,7 @@ #include "ui-summary.h" // Age, commit message and author, the three columns a log row always has. -// ui-log.c adds one more for each of the two optional counts, and the rows -// this page stretches across the table have to match that width. +// ui-log.c adds one more for each of the two optional counts. #define LOG_BASE_COLUMNS 3 static int clone_urls_printed; @@ -35,9 +34,21 @@ static int log_columns(void) return columns; } +/* + * The sections share one table, which is as wide as the widest of them, and + * every row fills it, since a short row would end its stripe short of the + * table's edge. + */ +static int table_columns(void) +{ + if (ctx.cfg.summary_log > 0 && log_columns() > REF_COLUMNS) + return log_columns(); + return REF_COLUMNS; +} + static void print_clone_url(const char *url) { - int columns = log_columns(); + int columns = table_columns(); // cgit_add_clone_urls may call back no times at all, so the heading // waits for a first url rather than being printed ahead of the walk. @@ -52,14 +63,16 @@ static void print_clone_url(const char *url) void cgit_print_summary(void) { + int columns = table_columns(); + cgit_print_layout_start(); // One table, so the columns line up across the sections, each of // which is a body of its own. html("<table class='list summary' aria-label='Summary'>\n"); - cgit_print_branches(ctx.cfg.summary_branches); - cgit_print_tags(ctx.cfg.summary_tags); + cgit_print_branches(ctx.cfg.summary_branches, columns); + cgit_print_tags(ctx.cfg.summary_tags, columns); if (ctx.cfg.summary_log > 0) - cgit_print_log(ctx.qry.head, 0, ctx.cfg.summary_log, NULL, NULL, NULL, 0, 0, 0); + cgit_print_log(ctx.qry.head, 0, ctx.cfg.summary_log, NULL, NULL, NULL, 0, 0, 0, columns); clone_urls_printed = 0; cgit_add_clone_urls(print_clone_url); if (clone_urls_printed) |
