X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/50fbd46c917a06f60235da59adb860697ea94eb0..0b3c746ba80738dbe0885a21406409390936537c:/ui-shared.c diff --git a/ui-shared.c b/ui-shared.c index 95dfeb4..de77bbf 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -369,6 +369,12 @@ void cgit_patch_link(char *name, char *title, char *class, char *head, reporevlink("patch", name, title, class, head, rev, NULL); } +void cgit_stats_link(char *name, char *title, char *class, char *head, + char *path) +{ + reporevlink("stats", name, title, class, head, NULL, path); +} + void cgit_object_link(struct object *obj) { char *page, *shortrev, *fullrev, *name; @@ -494,6 +500,8 @@ void cgit_print_docstart(struct cgit_context *ctx) } html("\n"); html("\n"); + if (ctx->cfg.header) + html_include(ctx->cfg.header); } void cgit_print_docend() @@ -557,7 +565,7 @@ int print_archive_ref(const char *refname, const unsigned char *sha1, return 0; } -void add_hidden_formfields(int incl_head, int incl_search, char *page) +void cgit_add_hidden_formfields(int incl_head, int incl_search, char *page) { char *url; @@ -587,15 +595,20 @@ void add_hidden_formfields(int incl_head, int incl_search, char *page) } } +const char *fallback_cmd = "repolist"; + char *hc(struct cgit_cmd *cmd, const char *page) { - return (strcmp(cmd->name, page) ? NULL : "active"); + return (strcmp(cmd ? cmd->name : fallback_cmd, page) ? NULL : "active"); } void cgit_print_pageheader(struct cgit_context *ctx) { struct cgit_cmd *cmd = cgit_get_cmd(ctx); + if (!cmd && ctx->repo) + fallback_cmd = "summary"; + html("\n"); html("\n"); html("