tvl-depot/web/cgit-taz/0003-cgit_subtree_about_links.patch
Vincent Ambo 9ad4796538 feat(cgit-taz): Add patches for subtree about/ handling
1. Generate links to subtree about pages.
2. Render README files in subtrees, too.
2019-12-21 23:36:39 +00:00

50 lines
1.6 KiB
Diff

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