author | Lars Hjemli <hjemli@gmail.com> | 2008-04-12 17:59:41 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2008-04-12 18:01:41 (UTC) |
commit | 7c0d2d9fbd3a29d295c8067f7798507853759eae (patch) (side-by-side diff) | |
tree | 0222feabc277488cb052b74be449b42a88ae42f4 | |
parent | 89aa3c0d0a4c6d9885272602005975b763ea1604 (diff) | |
download | cgit-7c0d2d9fbd3a29d295c8067f7798507853759eae.zip cgit-7c0d2d9fbd3a29d295c8067f7798507853759eae.tar.gz cgit-7c0d2d9fbd3a29d295c8067f7798507853759eae.tar.bz2 |
Add fixed link to index page from repo header
This makes it easier to get back to the index page, and also re-enables
the usage of logo-link in cgitrc.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-shared.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/ui-shared.c b/ui-shared.c index 7287956..03d147f 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -449,72 +449,78 @@ void add_hidden_formfields(int incl_head, int incl_search, char *page) url = fmt("%s/%s", url, ctx.qry.path); html_hidden("url", url); } if (incl_head && strcmp(ctx.qry.head, ctx.repo->defbranch)) html_hidden("h", ctx.qry.head); if (ctx.qry.sha1) html_hidden("id", ctx.qry.sha1); if (ctx.qry.sha2) html_hidden("id2", ctx.qry.sha2); if (incl_search) { if (ctx.qry.grep) html_hidden("qt", ctx.qry.grep); if (ctx.qry.search) html_hidden("q", ctx.qry.search); } } char *hc(struct cgit_cmd *cmd, const char *page) { return (strcmp(cmd->name, page) ? NULL : "active"); } void cgit_print_pageheader(struct cgit_context *ctx) { struct cgit_cmd *cmd = cgit_get_cmd(ctx); html("<table id='header'>\n"); html("<tr>\n"); html("<td class='logo' rowspan='2'><a href='"); - html_attr(cgit_rooturl()); + 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("'/></a></td>\n"); html("<td class='main'>"); - if (ctx->repo) + if (ctx->repo) { + html("<a href='"); + html_attr(cgit_rooturl()); + html("'>index</a> / "); html_txt(ctx->repo->name); - else + } else html_txt(ctx->cfg.root_title); html("</td></tr>\n"); html("<tr><td class='sub'>"); if (ctx->repo) html_txt(ctx->repo->desc); else html_txt(ctx->cfg.index_info); html("</td></tr>\n"); html("</table>\n"); html("<table class='tabs'><tr><td>\n"); if (ctx->repo) { reporevlink(NULL, "summary", NULL, hc(cmd, "summary"), ctx->qry.head, NULL, NULL); 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); cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head, ctx->qry.sha1, NULL); cgit_commit_link("commit", NULL, hc(cmd, "commit"), ctx->qry.head, ctx->qry.sha1); cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head, ctx->qry.sha1, ctx->qry.sha2, NULL); cgit_patch_link("patch", NULL, hc(cmd, "patch"), ctx->qry.head, ctx->qry.sha1); } else { html("<a class='active' href='"); html_attr(cgit_rooturl()); html("'>index</a>\n"); } html("</td></tr></table>\n"); |