about summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ui-shared.c31
1 files changed, 12 insertions, 19 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 7d7fff0..137e469 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -645,11 +645,9 @@ void cgit_add_hidden_formfields(int incl_head, int incl_search,
 	}
 }
 
-const char *fallback_cmd = "repolist";
-
-char *hc(struct cgit_cmd *cmd, const char *page)
+static const char *hc(struct cgit_context *ctx, const char *page)
 {
-	return (strcmp(cmd ? cmd->name : fallback_cmd, page) ? NULL : "active");
+	return strcmp(ctx->qry.page, page) ? NULL : "active";
 }
 
 static void print_header(struct cgit_context *ctx)
@@ -701,35 +699,30 @@ static void print_header(struct cgit_context *ctx)
 
 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) {
-		cgit_summary_link("summary", NULL, hc(cmd, "summary"),
+		cgit_summary_link("summary", NULL, hc(ctx, "summary"),
 				  ctx->qry.head);
-		cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head,
+		cgit_refs_link("refs", NULL, hc(ctx, "refs"), ctx->qry.head,
 			       ctx->qry.sha1, NULL);
-		cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head,
+		cgit_log_link("log", NULL, hc(ctx, "log"), ctx->qry.head,
 			      NULL, NULL, 0, NULL, NULL, ctx->qry.showmsg);
-		cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head,
+		cgit_tree_link("tree", NULL, hc(ctx, "tree"), ctx->qry.head,
 			       ctx->qry.sha1, NULL);
-		cgit_commit_link("commit", NULL, hc(cmd, "commit"),
+		cgit_commit_link("commit", NULL, hc(ctx, "commit"),
 				 ctx->qry.head, ctx->qry.sha1, 0);
-		cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head,
+		cgit_diff_link("diff", NULL, hc(ctx, "diff"), ctx->qry.head,
 			       ctx->qry.sha1, ctx->qry.sha2, NULL, 0);
 		if (ctx->repo->max_stats)
-			cgit_stats_link("stats", NULL, hc(cmd, "stats"),
+			cgit_stats_link("stats", NULL, hc(ctx, "stats"),
 					ctx->qry.head, NULL);
 		if (ctx->repo->readme)
 			reporevlink("about", "about", NULL,
-				    hc(cmd, "about"), ctx->qry.head, NULL,
+				    hc(ctx, "about"), ctx->qry.head, NULL,
 				    NULL);
 		html("</td><td class='form'>");
 		html("<form class='right' method='get' action='");
@@ -749,9 +742,9 @@ void cgit_print_pageheader(struct cgit_context *ctx)
 		html("<input type='submit' value='search'/>\n");
 		html("</form>\n");
 	} else {
-		site_link(NULL, "index", NULL, hc(cmd, "repolist"), NULL, 0);
+		site_link(NULL, "index", NULL, hc(ctx, "repolist"), NULL, 0);
 		if (ctx->cfg.root_readme)
-			site_link("about", "about", NULL, hc(cmd, "about"),
+			site_link("about", "about", NULL, hc(ctx, "about"),
 				  NULL, 0);
 		html("</td><td class='form'>");
 		html("<form method='get' action='");
'>2019-12-15Update git URLsJune McEnroe 2019-08-05Add buymeacoffee linkJune McEnroe Can't hurt, I guess? I don't expect to get anything... 2019-07-27Use braces in MakefileJune McEnroe 2019-07-08Remove NetHack from indexJune McEnroe 2019-04-08Don't install rc.kfcgi eitherJune McEnroe 2019-03-28Remove rc.kfcgiJune McEnroe I sent a better version of it to the port maintainer and it is now in the ports tree. 2019-01-16Reformat index.html with explore linkJune McEnroe 2019-01-16Return false from keydown handler in exploreJune McEnroe 2019-01-08Draw lines to tile edgeJune McEnroe 2019-01-08Factor out default pathsJune McEnroe 2019-01-08Remove incorrect default coordinatesJune McEnroe 2019-01-07Set img src when explore fragment changesJune McEnroe 2019-01-07Compress PNG data in imageJune McEnroe kcgi never enables compression for FastCGI. 2019-01-07madvise MADV_NOCORE in imageJune McEnroe 2019-01-07Add license notice to explore JavaScriptJune McEnroe 2019-01-07Add Q/Home binding in exploreJune McEnroe 2019-01-07Fix explore image URLJune McEnroe 2019-01-07Add HOME button, ssh link, AGPL notice to exploreJune McEnroe 2019-01-06Add meta viewport to exploreJune McEnroe 2019-01-06Set background and max-width in exploreJune McEnroe 2019-01-06Swallow writes after the connection is closedJune McEnroe It was not okay. 2019-01-06Handle KCGI_HUPJune McEnroe I hope it's okay that I keep writing to the fwopen stream after streamWrite returns -1. 2019-01-06Install html filesJune McEnroe