From 60c0125ae12be90d0bd279babfa4e40163553acd Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Wed, 15 Jul 2026 09:20:08 -1000 Subject: Rebuild the page chrome as semantic HTML The masthead, tab bar, breadcrumb, content region and footer were HTML tables, which cannot reflow and forced the page to scroll sideways on small screens. Class and id names are kept so custom themes keep matching, the tabs gain title hints and the form controls accessible names. --- source/ui-shared.c | 150 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 91 insertions(+), 59 deletions(-) (limited to 'source/ui-shared.c') diff --git a/source/ui-shared.c b/source/ui-shared.c index eb68ab7..69d2cdf 100644 --- a/source/ui-shared.c +++ b/source/ui-shared.c @@ -867,7 +867,7 @@ void cgit_print_docstart(void) void cgit_print_docend(void) { - html(" \n"); + html("\n"); if (ctx.cfg.embedded) { html(" \n"); if (ctx.cfg.footer) @@ -877,10 +877,10 @@ void cgit_print_docend(void) if (ctx.cfg.footer) html_include(ctx.cfg.footer); else { - htmlf("\n"); + html("\n"); } html(" \n"); html("\n\n"); @@ -1015,9 +1015,6 @@ static void print_header(void) { char *logo = NULL, *logo_link = NULL; - html("\n"); - html("\n"); - if (ctx.repo && ctx.repo->logo && *ctx.repo->logo) logo = ctx.repo->logo; else @@ -1026,44 +1023,47 @@ static void print_header(void) logo_link = ctx.repo->logo_link; else logo_link = ctx.cfg.logo_link; + + html("\n"); + html("' alt='cgit logo'/>\n"); } - html("\n"); + html("\n"); + + if (ctx.repo && ctx.env.authenticated) { + html("\n"); + cgit_add_hidden_formfields(0, 1, ctx.qry.page); + html(" "); + html(""); + html("\n"); + } - html("\n"); + html("\n"); } void cgit_print_pageheader(void) @@ -1084,39 +1086,63 @@ void cgit_print_pageheader(void) if (!ctx.env.authenticated || !ctx.cfg.noheader) print_header(); - html("
\n"); + if (ctx.env.authenticated) + html(""); - html("
\n"); cgit_add_hidden_formfields(1, 0, "log"); - html("\n"); html_option("grep", "log msg", ctx.qry.grep); html_option("author", "author", ctx.qry.grep); html_option("committer", "committer", ctx.qry.grep); html_option("range", "range", ctx.qry.grep); html("\n"); - html("\n"); html("\n"); html("
\n"); } else if (ctx.env.authenticated) { char *currenturl = cgit_currenturl(); - site_link(NULL, "index", NULL, hc("repolist"), NULL, NULL, 0, 1); - if (ctx.cfg.root_readme) - site_link("about", "about", NULL, hc("about"), + html("
    \n
  • "); + site_link(NULL, "index", "Repository index", hc("repolist"), NULL, NULL, 0, 1); + html("
  • \n"); + if (ctx.cfg.root_readme) { + html("
  • "); + site_link("about", "about", "About this site", hc("about"), NULL, NULL, 0, 1); - html("
"); - html("
\n"); - html("\n"); html("\n"); - html("
"); + html("\n"); free(currenturl); } - html("
\n"); + if (ctx.env.authenticated) + html("\n"); if (ctx.env.authenticated && ctx.repo && ctx.qry.vpath) { - html("
"); + html("
"); + html(""); } - html("
"); + html("
\n"); } void cgit_print_filemode(unsigned short mode) -- cgit v2.8.0