summaryrefslogtreecommitdiffabout
path: root/ui-shared.c
authorLars Hjemli <hjemli@gmail.com>2009-07-25 10:19:31 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2009-07-25 10:19:31 (UTC)
commitef0c6aadf70e33ef63f0a68ca16338a49d0a3f1f (patch) (unidiff)
tree4115c32dc27aa18840dda2c940ca10b4a7d0cf86 /ui-shared.c
parent0cbb50841ac82e08e715bbff614f96c7d5ba22fa (diff)
downloadcgit-ef0c6aadf70e33ef63f0a68ca16338a49d0a3f1f.zip
cgit-ef0c6aadf70e33ef63f0a68ca16338a49d0a3f1f.tar.gz
cgit-ef0c6aadf70e33ef63f0a68ca16338a49d0a3f1f.tar.bz2
Add support for 'noheader' option
This option can be used to disable the standard cgit page header, which might be useful in combination with the 'embedded' option. Suggested-by: Mark Constable <markc@renta.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'ui-shared.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-shared.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/ui-shared.c b/ui-shared.c
index f18b2c7..5e03a7a 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -608,20 +608,14 @@ const char *fallback_cmd = "repolist";
608 608
609char *hc(struct cgit_cmd *cmd, const char *page) 609char *hc(struct cgit_cmd *cmd, const char *page)
610{ 610{
611 return (strcmp(cmd ? cmd->name : fallback_cmd, page) ? NULL : "active"); 611 return (strcmp(cmd ? cmd->name : fallback_cmd, page) ? NULL : "active");
612} 612}
613 613
614void cgit_print_pageheader(struct cgit_context *ctx) 614static void print_header(struct cgit_context *ctx)
615{ 615{
616 struct cgit_cmd *cmd = cgit_get_cmd(ctx);
617
618 if (!cmd && ctx->repo)
619 fallback_cmd = "summary";
620
621 html("<div id='cgit'>");
622 html("<table id='header'>\n"); 616 html("<table id='header'>\n");
623 html("<tr>\n"); 617 html("<tr>\n");
624 html("<td class='logo' rowspan='2'><a href='"); 618 html("<td class='logo' rowspan='2'><a href='");
625 if (ctx->cfg.logo_link) 619 if (ctx->cfg.logo_link)
626 html_attr(ctx->cfg.logo_link); 620 html_attr(ctx->cfg.logo_link);
627 else 621 else
@@ -656,12 +650,24 @@ void cgit_print_pageheader(struct cgit_context *ctx)
656 if (ctx->cfg.root_desc) 650 if (ctx->cfg.root_desc)
657 html_txt(ctx->cfg.root_desc); 651 html_txt(ctx->cfg.root_desc);
658 else if (ctx->cfg.index_info) 652 else if (ctx->cfg.index_info)
659 html_include(ctx->cfg.index_info); 653 html_include(ctx->cfg.index_info);
660 } 654 }
661 html("</td></tr></table>\n"); 655 html("</td></tr></table>\n");
656}
657
658void cgit_print_pageheader(struct cgit_context *ctx)
659{
660 struct cgit_cmd *cmd = cgit_get_cmd(ctx);
661
662 if (!cmd && ctx->repo)
663 fallback_cmd = "summary";
664
665 html("<div id='cgit'>");
666 if (!ctx->cfg.noheader)
667 print_header(ctx);
662 668
663 html("<table class='tabs'><tr><td>\n"); 669 html("<table class='tabs'><tr><td>\n");
664 if (ctx->repo) { 670 if (ctx->repo) {
665 cgit_summary_link("summary", NULL, hc(cmd, "summary"), 671 cgit_summary_link("summary", NULL, hc(cmd, "summary"),
666 ctx->qry.head); 672 ctx->qry.head);
667 cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head, 673 cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head,