author | Lars Hjemli <hjemli@gmail.com> | 2009-07-25 10:19:31 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2009-07-25 10:19:31 (UTC) |
commit | ef0c6aadf70e33ef63f0a68ca16338a49d0a3f1f (patch) (unidiff) | |
tree | 4115c32dc27aa18840dda2c940ca10b4a7d0cf86 | |
parent | 0cbb50841ac82e08e715bbff614f96c7d5ba22fa (diff) | |
download | cgit-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>
-rw-r--r-- | cgit.c | 2 | ||||
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | ui-shared.c | 20 |
3 files changed, 16 insertions, 7 deletions
@@ -49,6 +49,8 @@ void config_cb(const char *name, const char *value) | |||
49 | ctx.cfg.virtual_root = ""; | 49 | ctx.cfg.virtual_root = ""; |
50 | } else if (!strcmp(name, "nocache")) | 50 | } else if (!strcmp(name, "nocache")) |
51 | ctx.cfg.nocache = atoi(value); | 51 | ctx.cfg.nocache = atoi(value); |
52 | else if (!strcmp(name, "noheader")) | ||
53 | ctx.cfg.noheader = atoi(value); | ||
52 | else if (!strcmp(name, "snapshots")) | 54 | else if (!strcmp(name, "snapshots")) |
53 | ctx.cfg.snapshots = cgit_parse_snapshots_mask(value); | 55 | ctx.cfg.snapshots = cgit_parse_snapshots_mask(value); |
54 | else if (!strcmp(name, "enable-index-links")) | 56 | else if (!strcmp(name, "enable-index-links")) |
@@ -172,6 +172,7 @@ struct cgit_config { | |||
172 | int summary_log; | 172 | int summary_log; |
173 | int summary_tags; | 173 | int summary_tags; |
174 | int embedded; | 174 | int embedded; |
175 | int noheader; | ||
175 | }; | 176 | }; |
176 | 177 | ||
177 | struct cgit_page { | 178 | struct cgit_page { |
diff --git a/ui-shared.c b/ui-shared.c index f18b2c7..5e03a7a 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -611,14 +611,8 @@ char *hc(struct cgit_cmd *cmd, const char *page) | |||
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 | ||
614 | void cgit_print_pageheader(struct cgit_context *ctx) | 614 | static 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='"); |
@@ -659,6 +653,18 @@ void cgit_print_pageheader(struct cgit_context *ctx) | |||
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 | |||
658 | void 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) { |