From 805732fdc76c55659a3ee4b9d1a655ba3c9a0abc Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 20 Mar 2014 00:12:33 -0400 Subject: [PATCH] Mirror fix --- modules/middleware/context.go | 5 +++++ modules/middleware/repo.go | 4 ++++ templates/repo/nav.tmpl | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/middleware/context.go b/modules/middleware/context.go index dfa39c6f8..6ac87de3b 100644 --- a/modules/middleware/context.go +++ b/modules/middleware/context.go @@ -34,6 +34,11 @@ type Context struct { IsWatching bool Repository *models.Repository Owner *models.User + CloneLink struct { + SSH string + HTTPS string + Git string + } } } diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go index e03ddc50a..f0cab8e89 100644 --- a/modules/middleware/repo.go +++ b/modules/middleware/repo.go @@ -6,11 +6,13 @@ package middleware import ( "errors" + "fmt" "strings" "github.com/codegangsta/martini" "github.com/gogits/gogs/models" + "github.com/gogits/gogs/modules/base" ) func RepoAssignment(redirect bool) martini.Handler { @@ -65,11 +67,13 @@ func RepoAssignment(redirect bool) martini.Handler { ctx.Repo.IsValid = true ctx.Repo.IsWatching = models.IsWatching(ctx.User.Id, repo.Id) ctx.Repo.Repository = repo + ctx.Repo.CloneLink.SSH = fmt.Sprintf("git@%s:%s/%s.git", base.Domain, ctx.User.LowerName, repo.LowerName) ctx.Data["IsRepositoryValid"] = true ctx.Data["Repository"] = repo ctx.Data["Owner"] = user ctx.Data["Title"] = user.Name + "/" + repo.Name + ctx.Data["CloneLink"] = ctx.Repo.CloneLink ctx.Data["RepositoryLink"] = ctx.Data["Title"] ctx.Data["IsRepositoryOwner"] = ctx.Repo.IsOwner } diff --git a/templates/repo/nav.tmpl b/templates/repo/nav.tmpl index d261bbd6e..92e529dbc 100644 --- a/templates/repo/nav.tmpl +++ b/templates/repo/nav.tmpl @@ -9,7 +9,7 @@
-