]> granicus.if.org Git - cgit/commitdiff
Add support for 'noheader' option
authorLars Hjemli <hjemli@gmail.com>
Sat, 25 Jul 2009 10:19:31 +0000 (12:19 +0200)
committerLars Hjemli <hjemli@gmail.com>
Sat, 25 Jul 2009 10:19:31 +0000 (12:19 +0200)
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>
cgit.c
cgit.h
ui-shared.c

diff --git a/cgit.c b/cgit.c
index 2aef44dbd1da27b62326d3dabfa7023a541095de..38f0fdda6c3d76bca1fe7dd0734253b1f9ac4529 100644 (file)
--- a/cgit.c
+++ b/cgit.c
@@ -49,6 +49,8 @@ void config_cb(const char *name, const char *value)
                        ctx.cfg.virtual_root = "";
        } else if (!strcmp(name, "nocache"))
                ctx.cfg.nocache = atoi(value);
+       else if (!strcmp(name, "noheader"))
+               ctx.cfg.noheader = atoi(value);
        else if (!strcmp(name, "snapshots"))
                ctx.cfg.snapshots = cgit_parse_snapshots_mask(value);
        else if (!strcmp(name, "enable-index-links"))
diff --git a/cgit.h b/cgit.h
index 73d7208a2c7d24a8dd627da6321809521a5f2b48..1056231fb0f9169ec9e1fec6f62bea542aa20d3c 100644 (file)
--- a/cgit.h
+++ b/cgit.h
@@ -172,6 +172,7 @@ struct cgit_config {
        int summary_log;
        int summary_tags;
        int embedded;
+       int noheader;
 };
 
 struct cgit_page {
index f18b2c74f661ce2ec1fbb5365ca9204fdaab8bfe..5e03a7a52ef7697f039b684f2fc1779fecbb9270 100644 (file)
@@ -611,14 +611,8 @@ 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='");
@@ -659,6 +653,18 @@ void cgit_print_pageheader(struct cgit_context *ctx)
                        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) {