Fork of patx/hglab.
tokenmess/hglab
show repos that have been forked in page eyebrow
Commit 895a7635d8f0 · Harrison Erd · 2026-05-03 22:13 -0400
Comments
No comments yet.
Diff
diff --git a/app.py b/app.py
--- a/app.py
+++ b/app.py
@@ -1274,6 +1274,7 @@
path = repo_path(repo["owner_username"], repo["name"])
user = current_user()
fork_target_id = repo["forked_from_repo_id"] or repo["id"]
+ source_repo = get_repo_by_id(repo["forked_from_repo_id"]) if repo["forked_from_repo_id"] else None
return {
"commit_count": commit_count(path),
"issue_counts": issue_counts(repo["id"]),
@@ -1284,6 +1285,7 @@
"can_maintain": user_can_maintain_repo(user, repo),
"has_fork": bool(user and user_has_fork_for_target(user["id"], fork_target_id)),
"repo_active_tab": repo_active_tab(repo),
+ "source_repo": source_repo,
}
@@ -1543,11 +1545,9 @@
readme_name, readme = readme_for_repo(path, files)
readme_is_markdown = is_markdown_file(readme_name)
context = repo_page_context(repo, path)
- source_repo = get_repo_by_id(repo["forked_from_repo_id"]) if repo["forked_from_repo_id"] else None
return render(
"repo.tpl",
repo=repo,
- source_repo=source_repo,
clone_url=clone_url(owner, repo_name),
readme_name=readme_name,
readme=readme,
diff --git a/templates/commit_detail.tpl b/templates/commit_detail.tpl
--- a/templates/commit_detail.tpl
+++ b/templates/commit_detail.tpl
@@ -2,6 +2,7 @@
<section class="repo-header slim">
<div>
+ % include("repo_fork_eyebrow.tpl")
<h1><a href="/{{repo['owner_username']}}">{{repo["owner_username"]}}</a>/{{repo["name"]}}</h1>
% include("repo_nav.tpl", repo=repo, commit_count=commit_count, issue_counts=issue_counts, pr_counts=pr_counts, star_count=star_count, is_starred=is_starred, is_owner=is_owner, can_maintain=can_maintain)
diff --git a/templates/commits.tpl b/templates/commits.tpl
--- a/templates/commits.tpl
+++ b/templates/commits.tpl
@@ -3,6 +3,7 @@
<section class="repo-header slim">
<div>
+ % include("repo_fork_eyebrow.tpl")
<h1><a href="/{{repo['owner_username']}}">{{repo["owner_username"]}}</a>/{{repo["name"]}}</h1>
% include("repo_nav.tpl", repo=repo, commit_count=commit_count, issue_counts=issue_counts, pr_counts=pr_counts, star_count=star_count, is_starred=is_starred, is_owner=is_owner, can_maintain=can_maintain)
diff --git a/templates/file.tpl b/templates/file.tpl
--- a/templates/file.tpl
+++ b/templates/file.tpl
@@ -2,6 +2,7 @@
<section class="repo-header slim">
<div>
+ % include("repo_fork_eyebrow.tpl")
<h1><a href="/{{repo['owner_username']}}">{{repo["owner_username"]}}</a>/{{repo["name"]}}</h1>
% include("repo_nav.tpl", repo=repo, commit_count=commit_count, issue_counts=issue_counts, pr_counts=pr_counts, star_count=star_count, is_starred=is_starred, is_owner=is_owner, can_maintain=can_maintain)
diff --git a/templates/issue_detail.tpl b/templates/issue_detail.tpl
--- a/templates/issue_detail.tpl
+++ b/templates/issue_detail.tpl
@@ -2,6 +2,7 @@
<section class="repo-header slim">
<div>
+ % include("repo_fork_eyebrow.tpl")
<h1><a href="/{{repo['owner_username']}}">{{repo["owner_username"]}}</a>/{{repo["name"]}}</h1>
% include("repo_nav.tpl", repo=repo, commit_count=commit_count, issue_counts=issue_counts, pr_counts=pr_counts, star_count=star_count, is_starred=is_starred, is_owner=is_owner, can_maintain=can_maintain)
diff --git a/templates/issues.tpl b/templates/issues.tpl
--- a/templates/issues.tpl
+++ b/templates/issues.tpl
@@ -2,6 +2,7 @@
<section class="repo-header slim">
<div>
+ % include("repo_fork_eyebrow.tpl")
<h1><a href="/{{repo['owner_username']}}">{{repo["owner_username"]}}</a>/{{repo["name"]}}</h1>
% include("repo_nav.tpl", repo=repo, commit_count=commit_count, issue_counts=issue_counts, pr_counts=pr_counts, star_count=star_count, is_starred=is_starred, is_owner=is_owner, can_maintain=can_maintain)
diff --git a/templates/new_issue.tpl b/templates/new_issue.tpl
--- a/templates/new_issue.tpl
+++ b/templates/new_issue.tpl
@@ -2,6 +2,7 @@
<section class="repo-header slim">
<div>
+ % include("repo_fork_eyebrow.tpl")
<h1><a href="/{{repo['owner_username']}}">{{repo["owner_username"]}}</a>/{{repo["name"]}}</h1>
% include("repo_nav.tpl", repo=repo, commit_count=commit_count, issue_counts=issue_counts, pr_counts=pr_counts, star_count=star_count, is_starred=is_starred, is_owner=is_owner, can_maintain=can_maintain)
diff --git a/templates/new_pull_request.tpl b/templates/new_pull_request.tpl
--- a/templates/new_pull_request.tpl
+++ b/templates/new_pull_request.tpl
@@ -2,6 +2,7 @@
<section class="repo-header slim">
<div>
+ % include("repo_fork_eyebrow.tpl")
<h1><a href="/{{repo['owner_username']}}">{{repo["owner_username"]}}</a>/{{repo["name"]}}</h1>
% include("repo_nav.tpl", repo=repo, commit_count=commit_count, issue_counts=issue_counts, pr_counts=pr_counts, star_count=star_count, is_starred=is_starred, is_owner=is_owner, can_maintain=can_maintain)
diff --git a/templates/pull_request_detail.tpl b/templates/pull_request_detail.tpl
--- a/templates/pull_request_detail.tpl
+++ b/templates/pull_request_detail.tpl
@@ -2,6 +2,7 @@
<section class="repo-header slim">
<div>
+ % include("repo_fork_eyebrow.tpl")
<h1><a href="/{{repo['owner_username']}}">{{repo["owner_username"]}}</a>/{{repo["name"]}}</h1>
% include("repo_nav.tpl", repo=repo, commit_count=commit_count, issue_counts=issue_counts, pr_counts=pr_counts, star_count=star_count, is_starred=is_starred, is_owner=is_owner, can_maintain=can_maintain)
diff --git a/templates/pull_requests.tpl b/templates/pull_requests.tpl
--- a/templates/pull_requests.tpl
+++ b/templates/pull_requests.tpl
@@ -2,6 +2,7 @@
<section class="repo-header slim">
<div>
+ % include("repo_fork_eyebrow.tpl")
<h1><a href="/{{repo['owner_username']}}">{{repo["owner_username"]}}</a>/{{repo["name"]}}</h1>
% include("repo_nav.tpl", repo=repo, commit_count=commit_count, issue_counts=issue_counts, pr_counts=pr_counts, star_count=star_count, is_starred=is_starred, is_owner=is_owner, can_maintain=can_maintain)
diff --git a/templates/repo.tpl b/templates/repo.tpl
--- a/templates/repo.tpl
+++ b/templates/repo.tpl
@@ -2,11 +2,7 @@
<section class="repo-header">
<div>
- <p class="eyebrow">
- % if source_repo:
- Fork of <a href="/{{source_repo['owner_username']}}/{{source_repo['name']}}">{{source_repo["owner_username"]}}/{{source_repo["name"]}}</a>.</p>
- % end
- </p>
+ % include("repo_fork_eyebrow.tpl")
<h1><a href="/{{repo['owner_username']}}">{{repo["owner_username"]}}</a>/{{repo["name"]}}</h1>
% include("repo_nav.tpl", repo=repo, commit_count=commit_count, issue_counts=issue_counts, pr_counts=pr_counts, star_count=star_count, is_starred=is_starred, is_owner=is_owner, can_maintain=can_maintain)
diff --git a/templates/repo_fork_eyebrow.tpl b/templates/repo_fork_eyebrow.tpl
new file mode 100644
--- /dev/null
+++ b/templates/repo_fork_eyebrow.tpl
@@ -0,0 +1,4 @@
+% source_repo = get("source_repo", None)
+% if source_repo:
+ <p class="eyebrow">Fork of <a href="/{{source_repo['owner_username']}}/{{source_repo['name']}}">{{source_repo["owner_username"]}}/{{source_repo["name"]}}</a>.</p>
+% end
diff --git a/templates/repo_settings.tpl b/templates/repo_settings.tpl
--- a/templates/repo_settings.tpl
+++ b/templates/repo_settings.tpl
@@ -2,6 +2,7 @@
<section class="repo-header slim">
<div>
+ % include("repo_fork_eyebrow.tpl")
<h1><a href="/{{repo['owner_username']}}">{{repo["owner_username"]}}</a>/{{repo["name"]}}</h1>
% include("repo_nav.tpl", repo=repo, commit_count=commit_count, issue_counts=issue_counts, pr_counts=pr_counts, star_count=star_count, is_starred=is_starred, is_owner=is_owner, can_maintain=can_maintain)
diff --git a/templates/source.tpl b/templates/source.tpl
--- a/templates/source.tpl
+++ b/templates/source.tpl
@@ -2,6 +2,7 @@
<section class="repo-header slim">
<div>
+ % include("repo_fork_eyebrow.tpl")
<h1><a href="/{{repo['owner_username']}}">{{repo["owner_username"]}}</a>/{{repo["name"]}}</h1>
% include("repo_nav.tpl", repo=repo, commit_count=commit_count, issue_counts=issue_counts, pr_counts=pr_counts, star_count=star_count, is_starred=is_starred, is_owner=is_owner, can_maintain=can_maintain)