about summary refs log tree commit diff
path: root/web/cgit-taz/0003-cgit_subtree_about_links.patch
blob: 6b3d0a70b11d00f9998e6253001fe83471f907fb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
From 531b55dc96bb7ee2ce52a3612021e1c1f4ddac8a Mon Sep 17 00:00:00 2001
From: Vincent Ambo <tazjin@google.com>
Date: Sat, 21 Dec 2019 23:27:28 +0000
Subject: [PATCH 3/3] feat(ui-shared): Generate links to about pages from
 subtrees

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.
---
 ui-shared.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/ui-shared.c b/ui-shared.c
index c7c3754..c37835a 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -297,6 +297,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)
 {
@@ -985,10 +991,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,
-- 
2.24.1.735.g03f4e72817-goog