From 4f64d3fa0e20f3b4d56fb8b8bd7e0788944a8c38 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Sat, 4 May 2013 15:38:00 +0200 Subject: Start bootstrapping cgit --- ui-shared.c | 240 +++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 141 insertions(+), 99 deletions(-) (limited to 'ui-shared.c') diff --git a/ui-shared.c b/ui-shared.c index 75b97a1..6ed1bd4 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -11,8 +11,7 @@ #include "html.h" const char cgit_doctype[] = -"\n"; + "\n"; static char *http_date(time_t t) { @@ -198,7 +197,7 @@ static char *repolink(const char *title, const char *class, const char *page, { char *delim = "?"; - html("\n"); } - if (ctx->cfg.head_include) + if (ctx->cfg.head_include) html_include(ctx->cfg.head_include); html("\n"); html("\n"); @@ -803,147 +802,190 @@ static void cgit_print_path_crumbs(struct cgit_context *ctx, char *path) char *old_path = ctx->qry.path; char *p = path, *q, *end = path + strlen(path); + html(""); ctx->qry.path = old_path; } static void print_header(struct cgit_context *ctx) { - char *logo = NULL, *logo_link = NULL; + /* char *logo = NULL, *logo_link = NULL; */ - html("\n"); - html("\n"); + html("\n"); - } + html(""); + html_txt("ryuslash/code"); + html(""); - html("\n"); + } - html("\n"); -} + html("\n"); + html("\n"); -void cgit_print_pageheader(struct cgit_context *ctx) -{ - html("
"); - if (!ctx->cfg.noheader) - print_header(ctx); - - html("\n"); */ + /* } */ +} + +void cgit_print_pageheader(struct cgit_context *ctx) +{ + html("
"); + if (!ctx->cfg.noheader) + print_header(ctx); + + html(""); + + + html("
\n"); - if (ctx->repo) { - cgit_summary_link("summary", NULL, hc(ctx, "summary"), - ctx->qry.head); - cgit_refs_link("refs", NULL, hc(ctx, "refs"), ctx->qry.head, - ctx->qry.sha1, NULL); - cgit_log_link("log", NULL, hc(ctx, "log"), ctx->qry.head, - NULL, ctx->qry.vpath, 0, NULL, NULL, - ctx->qry.showmsg); - cgit_tree_link("tree", NULL, hc(ctx, "tree"), ctx->qry.head, - ctx->qry.sha1, ctx->qry.vpath); - cgit_commit_link("commit", NULL, hc(ctx, "commit"), - ctx->qry.head, ctx->qry.sha1, ctx->qry.vpath, 0); - cgit_diff_link("diff", NULL, hc(ctx, "diff"), ctx->qry.head, - ctx->qry.sha1, ctx->qry.sha2, ctx->qry.vpath, 0); - if (ctx->repo->max_stats) - cgit_stats_link("stats", NULL, hc(ctx, "stats"), - ctx->qry.head, ctx->qry.vpath); - if (ctx->repo->readme) - reporevlink("about", "about", NULL, - hc(ctx, "about"), ctx->qry.head, NULL, - NULL); - html(""); - html("
\n"); cgit_add_hidden_formfields(1, 0, "log"); - html("\n"); html_option("grep", "log msg", ctx->qry.grep); html_option("author", "author", ctx->qry.grep); html_option("committer", "committer", ctx->qry.grep); html_option("range", "range", ctx->qry.grep); html("\n"); - html("\n"); - html("\n"); + html("\n"); html("
\n"); - } else { - site_link(NULL, "index", NULL, hc(ctx, "repolist"), NULL, NULL, 0); - if (ctx->cfg.root_readme) - site_link("about", "about", NULL, hc(ctx, "about"), - NULL, NULL, 0); - html("
"); - html("
\n"); - html("\n"); - html("\n"); + html("\n"); html("
"); + } + + html("

"); + if (ctx->repo) + html_txt(ctx->repo->name); + else + html_txt(ctx->cfg.root_title); + + html(" "); + if (ctx->repo) + html_txt(ctx->repo->desc); + else if (ctx->cfg.root_desc) + html_txt(ctx->cfg.root_desc); + html(""); + html("

"); + + /* if (ctx->repo && ctx->repo->logo && *ctx->repo->logo) */ + /* logo = ctx->repo->logo; */ + /* else */ + /* logo = ctx->cfg.logo; */ + /* if (ctx->repo && ctx->repo->logo_link && *ctx->repo->logo_link) */ + /* logo_link = ctx->repo->logo_link; */ + /* else */ + /* logo_link = ctx->cfg.logo_link; */ + /* if (logo && *logo) { */ + /* html("
\n"); + if (ctx->repo) { + html(""); + } else { + html(""); } html("
\n"); - if (ctx->qry.vpath) { - html("
"); - html("path: "); + if (ctx->qry.vpath) cgit_print_path_crumbs(ctx, ctx->qry.vpath); - html("
"); - } + html("
"); } -- cgit v1.2.3-54-g00ecf