From 6d4d140058af748b03ce808a2bd4463ded2ec058 Mon Sep 17 00:00:00 2001
From: Runxi Yu <me@runxiyu.org>
Date: Tue, 11 Feb 2025 23:55:26 +0800
Subject: [PATCH] *.html: Add a simple repo header

---
 templates/_repo_header.html.tmpl   | 7 +++++++
 templates/repo_commit.html.tmpl    | 3 +++
 templates/repo_index.html.tmpl     | 3 +++
 templates/repo_log.html.tmpl       | 3 +++
 templates/repo_raw_dir.html.tmpl   | 3 +++
 templates/repo_tree_dir.html.tmpl  | 3 +++
 templates/repo_tree_file.html.tmpl | 3 +++

diff --git a/templates/_repo_header.html.tmpl b/templates/_repo_header.html.tmpl
new file mode 100644
index 0000000000000000000000000000000000000000..1dd14f93fd06860e59ef6a19216f1071c91b13cc
--- /dev/null
+++ b/templates/_repo_header.html.tmpl
@@ -0,0 +1,7 @@
+{{- define "repo_header" -}}
+<a href="/g/{{ .group_name }}/">{{ .group_name }}</a>
+/
+<a href="/g/{{ .group_name }}/repos/">repos</a>
+/
+<a href="/g/{{ .group_name }}/repos/{{ .repo_name }}/">{{ .repo_name }}</a>
+{{- end -}}
diff --git a/templates/repo_commit.html.tmpl b/templates/repo_commit.html.tmpl
index 13832a8b000cf3bcce30218fd4506cdb065e3f7a..a09f7f2d9209f07a78e1059b599097272d9fb99b 100644
--- a/templates/repo_commit.html.tmpl
+++ b/templates/repo_commit.html.tmpl
@@ -6,6 +6,9 @@ 		{{ template "head_common" . }}
 		<title>{{ .group_name }}/repos/{{ .repo_name }} &ndash; Lindenii Forge</title>
 	</head>
 	<body class="repo-commit">
+		<header>
+			{{ template "repo_header" . }}
+		</header>
 		<div class="padding-wrapper scroll">
 			<table id="commit-info-table">
 				<thead>
diff --git a/templates/repo_index.html.tmpl b/templates/repo_index.html.tmpl
index 2f41aacf6d7442e80e83136bcb3bc1efff360ad3..47c6381236e9039aab5b21dda033d5e5874d3697 100644
--- a/templates/repo_index.html.tmpl
+++ b/templates/repo_index.html.tmpl
@@ -6,6 +6,9 @@ 		{{ template "head_common" . }}
 		<title>{{ .group_name }}/repos/{{ .repo_name }} &ndash; Lindenii Forge</title>
 	</head>
 	<body class="repo-index">
+		<header>
+			{{ template "repo_header" . }}
+		</header>
 		<div class="padding-wrapper scroll">
 			<input id="toggle-table-recent-commits" type="checkbox" class="toggle-table-off" />
 			<table id="recent-commits" class="wide">
diff --git a/templates/repo_log.html.tmpl b/templates/repo_log.html.tmpl
index 898a84a35d9bdb220b876471de15cd75aff801b5..9ef489e5ab3b03129eaccad1480464660afab41d 100644
--- a/templates/repo_log.html.tmpl
+++ b/templates/repo_log.html.tmpl
@@ -6,6 +6,9 @@ 		{{ template "head_common" . }}
 		<title>Log of {{ .group_name }}/repos/{{ .repo_name }} &ndash; Lindenii Forge</title>
 	</head>
 	<body class="repo-log">
+		<header>
+			{{ template "repo_header" . }}
+		</header>
 		<table id="commits" class="wide">
 			<thead>
 				<tr class="title-row">
diff --git a/templates/repo_raw_dir.html.tmpl b/templates/repo_raw_dir.html.tmpl
index f55d8c86e65369be5b1ec79803c4c5ae76dd1e10..055445d34f7e9fa9315d29e6b27fa3a06f4b1b87 100644
--- a/templates/repo_raw_dir.html.tmpl
+++ b/templates/repo_raw_dir.html.tmpl
@@ -6,6 +6,9 @@ 		{{ template "head_common" . }}
 		<title>{{ .group_name }}/repos/{{ .repo_name }}/{{ .path_spec }}{{ if ne .path_spec "" }}/{{ end }} &ndash; Lindenii Forge</title>
 	</head>
 	<body class="repo-raw-dir">
+		<header>
+			{{ template "repo_header" . }}
+		</header>
 		<div class="padding-wrapper scroll">
 			<table id="file-tree" class="wide">
 				<thead>
diff --git a/templates/repo_tree_dir.html.tmpl b/templates/repo_tree_dir.html.tmpl
index aa457c4312a6f5bfb2fd12eff9f5c4dd46098f22..07a8df5453d2d9e6bfdb6a469f25a4a1d2fee4a4 100644
--- a/templates/repo_tree_dir.html.tmpl
+++ b/templates/repo_tree_dir.html.tmpl
@@ -6,6 +6,9 @@ 		{{ template "head_common" . }}
 		<title>{{ .group_name }}/repos/{{ .repo_name }}/{{ .path_spec }}{{ if ne .path_spec "" }}/{{ end }} &ndash; Lindenii Forge</title>
 	</head>
 	<body class="repo-tree-dir">
+		<header>
+			{{ template "repo_header" . }}
+		</header>
 		<div class="padding-wrapper scroll">
 			<table id="file-tree" class="wide">
 				<thead>
diff --git a/templates/repo_tree_file.html.tmpl b/templates/repo_tree_file.html.tmpl
index 0401bb07eaf85aa9251347329e3e62d8647585a4..cf82c44506078b8bd06d0a1a70cb9a1922faae72 100644
--- a/templates/repo_tree_file.html.tmpl
+++ b/templates/repo_tree_file.html.tmpl
@@ -7,6 +7,9 @@ 		<link rel="stylesheet" href="/static/chroma.css" />
 		<title>{{ .group_name }}/repos/{{ .repo_name }}/{{ .path_spec }} &ndash; Lindenii Forge</title>
 	</head>
 	<body class="repo-tree-file">
+		<header>
+			{{ template "repo_header" . }}
+		</header>
 		<p>
 			/{{ .path_spec }} (<a href="/g/{{ .group_name }}/repos/{{ .repo_name }}/raw/{{ .path_spec }}?{{ .ref_type }}={{ .ref }}">raw</a>)
 		</p>

-- 
2.48.1