From 275464e7fb14c3cb33540f05426b1e5cdca9dd2d Mon Sep 17 00:00:00 2001 From: Josh Frye Date: Fri, 4 Mar 2016 14:50:34 -0500 Subject: [PATCH] Use relative url when showing forked from --- models/repo.go | 5 +++++ templates/repo/header.tmpl | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/models/repo.go b/models/repo.go index 17c0082cbd..a23abc0c2e 100644 --- a/models/repo.go +++ b/models/repo.go @@ -321,6 +321,11 @@ func (repo *Repository) RepoLink() string { return setting.AppSubUrl + "/" + repo.MustOwner().Name + "/" + repo.Name } +func (repo *Repository) RepoRelLink() string { + return "/" + repo.MustOwner().Name + "/" + repo.Name +} + + func (repo *Repository) ComposeCompareURL(oldCommitID, newCommitID string) string { return fmt.Sprintf("%s/%s/compare/%s...%s", repo.MustOwner().Name, repo.Name, oldCommitID, newCommitID) } diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index 34ef9fafa1..2bae961dae 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -10,7 +10,7 @@
/
{{.Name}} {{if .IsMirror}}
{{$.i18n.Tr "repo.mirror_from"}} {{$.Mirror.Address}}
{{end}} - {{if .IsFork}}
{{$.i18n.Tr "repo.forked_from"}} {{SubStr .BaseRepo.RepoLink 1 -1}}
{{end}} + {{if .IsFork}}
{{$.i18n.Tr "repo.forked_from"}} {{SubStr .BaseRepo.RepoRelLink 1 -1}}
{{end}}
@@ -86,4 +86,4 @@ {{else}}
{{end}} -
\ No newline at end of file +