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) (side-by-side diff)
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
@@ -602,32 +602,26 @@ void cgit_add_hidden_formfields(int incl_head, int incl_search, char *page)
if (ctx.qry.search)
html_hidden("q", ctx.qry.search);
}
}
const char *fallback_cmd = "repolist";
char *hc(struct cgit_cmd *cmd, const char *page)
{
return (strcmp(cmd ? cmd->name : fallback_cmd, page) ? NULL : "active");
}
-void cgit_print_pageheader(struct cgit_context *ctx)
+static void print_header(struct cgit_context *ctx)
{
- struct cgit_cmd *cmd = cgit_get_cmd(ctx);
-
- if (!cmd && ctx->repo)
- fallback_cmd = "summary";
-
- html("<div id='cgit'>");
html("<table id='header'>\n");
html("<tr>\n");
html("<td class='logo' rowspan='2'><a href='");
if (ctx->cfg.logo_link)
html_attr(ctx->cfg.logo_link);
else
html_attr(cgit_rooturl());
html("'><img src='");
html_attr(ctx->cfg.logo);
html("' alt='cgit logo'/></a></td>\n");
html("<td class='main'>");
@@ -650,24 +644,36 @@ void cgit_print_pageheader(struct cgit_context *ctx)
html("<tr><td class='sub'>");
if (ctx->repo) {
html_txt(ctx->repo->desc);
html("</td><td class='sub right'>");
html_txt(ctx->repo->owner);
} else {
if (ctx->cfg.root_desc)
html_txt(ctx->cfg.root_desc);
else if (ctx->cfg.index_info)
html_include(ctx->cfg.index_info);
}
html("</td></tr></table>\n");
+}
+
+void cgit_print_pageheader(struct cgit_context *ctx)
+{
+ struct cgit_cmd *cmd = cgit_get_cmd(ctx);
+
+ if (!cmd && ctx->repo)
+ fallback_cmd = "summary";
+
+ html("<div id='cgit'>");
+ if (!ctx->cfg.noheader)
+ print_header(ctx);
html("<table class='tabs'><tr><td>\n");
if (ctx->repo) {
cgit_summary_link("summary", NULL, hc(cmd, "summary"),
ctx->qry.head);
cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head,
ctx->qry.sha1, NULL);
cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head,
NULL, NULL, 0, NULL, NULL, ctx->qry.showmsg);
cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head,
ctx->qry.sha1, NULL);
cgit_commit_link("commit", NULL, hc(cmd, "commit"),