summaryrefslogtreecommitdiffabout
authorLars Hjemli <hjemli@gmail.com>2008-04-14 22:00:11 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2008-04-14 22:00:11 (UTC)
commit3cfcb086abfc2e94426623b487a47a8b5cc57b7e (patch) (unidiff)
tree3ec281d445d710647bca817cac93cc794093b569
parent78031f92b0ff064efa82065a3cf6020c1256a5fd (diff)
downloadcgit-3cfcb086abfc2e94426623b487a47a8b5cc57b7e.zip
cgit-3cfcb086abfc2e94426623b487a47a8b5cc57b7e.tar.gz
cgit-3cfcb086abfc2e94426623b487a47a8b5cc57b7e.tar.bz2
Cleanup page header
Fix some invalid html, remove dead code. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ui-shared.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/ui-shared.c b/ui-shared.c
index bb08c4a..8a804c2 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -463,90 +463,77 @@ void add_hidden_formfields(int incl_head, int incl_search, char *page)
463 html_hidden("qt", ctx.qry.grep); 463 html_hidden("qt", ctx.qry.grep);
464 if (ctx.qry.search) 464 if (ctx.qry.search)
465 html_hidden("q", ctx.qry.search); 465 html_hidden("q", ctx.qry.search);
466 } 466 }
467} 467}
468 468
469char *hc(struct cgit_cmd *cmd, const char *page) 469char *hc(struct cgit_cmd *cmd, const char *page)
470{ 470{
471 return (strcmp(cmd->name, page) ? NULL : "active"); 471 return (strcmp(cmd->name, page) ? NULL : "active");
472} 472}
473 473
474void cgit_print_pageheader(struct cgit_context *ctx) 474void cgit_print_pageheader(struct cgit_context *ctx)
475{ 475{
476 struct cgit_cmd *cmd = cgit_get_cmd(ctx); 476 struct cgit_cmd *cmd = cgit_get_cmd(ctx);
477 477
478 html("<table id='header'>\n"); 478 html("<table id='header'>\n");
479 html("<tr>\n"); 479 html("<tr>\n");
480 html("<td class='logo' rowspan='2'><a href='"); 480 html("<td class='logo' rowspan='2'><a href='");
481 if (ctx->cfg.logo_link) 481 if (ctx->cfg.logo_link)
482 html_attr(ctx->cfg.logo_link); 482 html_attr(ctx->cfg.logo_link);
483 else 483 else
484 html_attr(cgit_rooturl()); 484 html_attr(cgit_rooturl());
485 html("'><img src='"); 485 html("'><img src='");
486 html_attr(ctx->cfg.logo); 486 html_attr(ctx->cfg.logo);
487 html("'/></a></td>\n"); 487 html("' alt='cgit logo'/></a></td>\n");
488 488
489 html("<td class='main'>"); 489 html("<td class='main'>");
490 if (ctx->repo) { 490 if (ctx->repo) {
491/*
492 html("<a href='");
493 html_attr(cgit_rooturl());
494 html("'>index</a> : ");
495*/
496 reporevlink(NULL, ctx->repo->name, NULL, hc(cmd, "summary"), 491 reporevlink(NULL, ctx->repo->name, NULL, hc(cmd, "summary"),
497 ctx->qry.head, NULL, NULL); 492 ctx->qry.head, NULL, NULL);
498 html(" : "); 493 html(" : ");
499 html_txt(ctx->qry.page); 494 html_txt(ctx->qry.page);
500 html("</td><td class='form'>"); 495 html("</td><td class='form'>");
501 html("<form method='get' action=''>\n"); 496 html("<form method='get' action=''>\n");
502 add_hidden_formfields(0, 1, ctx->qry.page); 497 add_hidden_formfields(0, 1, ctx->qry.page);
503 html("<select name='h' onchange='this.form.submit();'>\n"); 498 html("<select name='h' onchange='this.form.submit();'>\n");
504 for_each_branch_ref(print_branch_option, ctx->qry.head); 499 for_each_branch_ref(print_branch_option, ctx->qry.head);
505 html("</select> "); 500 html("</select> ");
506 html("<input type='submit' name='' value='switch'/>"); 501 html("<input type='submit' name='' value='switch'/>");
507 html("</form>"); 502 html("</form>");
508 } else 503 } else
509 html_txt(ctx->cfg.root_title); 504 html_txt(ctx->cfg.root_title);
510 html("</td>\n"); 505 html("</td></tr>\n");
511 506
512 html("<tr><td class='sub'"); 507 html("<tr><td class='sub'");
513 if (ctx->repo) { 508 if (ctx->repo) {
514 html(" colspan='2'>"); 509 html(" colspan='2'>");
515 html_txt(ctx->repo->desc); 510 html_txt(ctx->repo->desc);
516 } 511 } else {
517/*
518 else if (ctx->cfg.root_subtitle)
519 html_txt(ctx->cfg.root_subtitle);
520*/
521 else {
522 html(">"); 512 html(">");
523 html_txt("a fast webinterface for the git dscm"); 513 html_txt("a fast webinterface for the git dscm");
524 } 514 }
525 html("</td></tr>\n"); 515 html("</td></tr></table>\n");
526
527 html("</tr>\n");
528 html("</table>\n");
529 516
530 html("<table class='tabs'><tr><td>\n"); 517 html("<table class='tabs'><tr><td>\n");
531 if (ctx->repo) { 518 if (ctx->repo) {
532 reporevlink(NULL, "summary", NULL, hc(cmd, "summary"), 519 reporevlink(NULL, "summary", NULL, hc(cmd, "summary"),
533 ctx->qry.head, NULL, NULL); 520 ctx->qry.head, NULL, NULL);
534 cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head, 521 cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head,
535 ctx->qry.sha1, NULL); 522 ctx->qry.sha1, NULL);
536 cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head, 523 cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head,
537 NULL, NULL, 0, NULL, NULL); 524 NULL, NULL, 0, NULL, NULL);
538 cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head, 525 cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head,
539 ctx->qry.sha1, NULL); 526 ctx->qry.sha1, NULL);
540 cgit_commit_link("commit", NULL, hc(cmd, "commit"), 527 cgit_commit_link("commit", NULL, hc(cmd, "commit"),
541 ctx->qry.head, ctx->qry.sha1); 528 ctx->qry.head, ctx->qry.sha1);
542 cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head, 529 cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head,
543 ctx->qry.sha1, ctx->qry.sha2, NULL); 530 ctx->qry.sha1, ctx->qry.sha2, NULL);
544 html("</td><td class='form'>"); 531 html("</td><td class='form'>");
545 html("<form class='right' method='get' action='"); 532 html("<form class='right' method='get' action='");
546 if (ctx->cfg.virtual_root) 533 if (ctx->cfg.virtual_root)
547 html_attr(cgit_fileurl(ctx->qry.repo, "log", 534 html_attr(cgit_fileurl(ctx->qry.repo, "log",
548 ctx->qry.path, NULL)); 535 ctx->qry.path, NULL));
549 html("'>\n"); 536 html("'>\n");
550 add_hidden_formfields(1, 0, "log"); 537 add_hidden_formfields(1, 0, "log");
551 html("<select name='qt'>\n"); 538 html("<select name='qt'>\n");
552 html_option("grep", "log msg", ctx->qry.grep); 539 html_option("grep", "log msg", ctx->qry.grep);