about summary refs log tree commit diff
path: root/third_party/cgit/ui-shared.c
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-12-21T23·27+0000
committerVincent Ambo <Vincent Ambo>2020-01-11T23·47+0000
commitbe2f51e1dd583cb3e03572aaab2fff682ba849ee (patch)
treeae087f793c19839d8197573ff66a15cb575a44d9 /third_party/cgit/ui-shared.c
parent0294eec9da79ba3bebf351c22d04c67b22dc920f (diff)
feat(third_party/cgit): Generate links to about pages from subtrees r/377
If you're on tree/foo/bar, the about link will now point to
about/foo/bar.

Currently the annoying thing about this is that it will also do it for
files.
Diffstat (limited to 'third_party/cgit/ui-shared.c')
-rw-r--r--third_party/cgit/ui-shared.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/third_party/cgit/ui-shared.c b/third_party/cgit/ui-shared.c
index 0b9307f55d3c..00efbceb20b0 100644
--- a/third_party/cgit/ui-shared.c
+++ b/third_party/cgit/ui-shared.c
@@ -330,6 +330,12 @@ void cgit_tag_link(const char *name, const char *title, const char *class,
 	reporevlink("tag", name, title, class, tag, NULL, NULL);
 }
 
+void cgit_about_link(const char *name, const char *title, const char *class,
+		    const char *head, const char *rev, const char *path)
+{
+	reporevlink("about", name, title, class, head, rev, path);
+}
+
 void cgit_tree_link(const char *name, const char *title, const char *class,
 		    const char *head, const char *rev, const char *path)
 {
@@ -1020,10 +1026,10 @@ void cgit_print_pageheader(void)
 
 	html("<table class='tabs'><tr><td>\n");
 	if (ctx.env.authenticated && ctx.repo) {
-		if (ctx.repo->readme.nr)
-			reporevlink("about", "about", NULL,
-				    hc("about"), ctx.qry.head, NULL,
-				    NULL);
+		if (ctx.repo->readme.nr) {
+			cgit_about_link("about", NULL, hc("about"), ctx.qry.head,
+					 ctx.qry.sha1, ctx.qry.vpath);
+		}
 		cgit_summary_link("summary", NULL, hc("summary"),
 				  ctx.qry.head);
 		cgit_refs_link("refs", NULL, hc("refs"), ctx.qry.head,