diff options
author | Unknwon <u@gogs.io> | 2016-03-04 18:37:42 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-03-04 18:37:42 -0500 |
commit | dfd6f8f7abb30ae9f89a06d16dba7dc9039f2ba1 (patch) | |
tree | d0f310548c207b8bbb48fafa9be8041beea5caa5 | |
parent | e2d370f0da8e3f8092240b745347d863c319885f (diff) | |
parent | 275464e7fb14c3cb33540f05426b1e5cdca9dd2d (diff) | |
download | gitea-dfd6f8f7abb30ae9f89a06d16dba7dc9039f2ba1.tar.gz gitea-dfd6f8f7abb30ae9f89a06d16dba7dc9039f2ba1.zip |
Merge pull request #2757 from joshfng/fix-fork-relative-url
Use relative url when showing forked from
-rw-r--r-- | models/repo.go | 5 | ||||
-rw-r--r-- | templates/repo/header.tmpl | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/models/repo.go b/models/repo.go index 3f631b6984..eff66254f0 100644 --- a/models/repo.go +++ b/models/repo.go @@ -326,6 +326,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 @@ <div class="divider"> / </div> <a href="{{$.RepoLink}}">{{.Name}}</a> {{if .IsMirror}}<div class="fork-flag">{{$.i18n.Tr "repo.mirror_from"}} <a target="_blank" href="{{$.Mirror.Address}}">{{$.Mirror.Address}}</a></div>{{end}} - {{if .IsFork}}<div class="fork-flag">{{$.i18n.Tr "repo.forked_from"}} <a href="{{.BaseRepo.RepoLink}}">{{SubStr .BaseRepo.RepoLink 1 -1}}</a></div>{{end}} + {{if .IsFork}}<div class="fork-flag">{{$.i18n.Tr "repo.forked_from"}} <a href="{{.BaseRepo.RepoLink}}">{{SubStr .BaseRepo.RepoRelLink 1 -1}}</a></div>{{end}} </div> <div class="ui right"> @@ -86,4 +86,4 @@ {{else}} <div class="ui divider"></div> {{end}} -</div>
\ No newline at end of file +</div> |