summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-03-20 00:12:33 -0400
committerUnknown <joe2010xtmf@163.com>2014-03-20 00:12:33 -0400
commit805732fdc76c55659a3ee4b9d1a655ba3c9a0abc (patch)
tree8f789fe406a74ef9e31cb10aeacb881e4b9997df
parentee92fb8635cf9f80453386f2dc4f8b3cd7e9a17e (diff)
downloadgitea-805732fdc76c55659a3ee4b9d1a655ba3c9a0abc.tar.gz
gitea-805732fdc76c55659a3ee4b9d1a655ba3c9a0abc.zip
Mirror fix
-rw-r--r--modules/middleware/context.go5
-rw-r--r--modules/middleware/repo.go4
-rw-r--r--templates/repo/nav.tmpl2
3 files changed, 10 insertions, 1 deletions
diff --git a/modules/middleware/context.go b/modules/middleware/context.go
index dfa39c6f86..6ac87de3be 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 e03ddc50a6..f0cab8e895 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 d261bbd6e9..92e529dbc7 100644
--- a/templates/repo/nav.tmpl
+++ b/templates/repo/nav.tmpl
@@ -9,7 +9,7 @@
<div class="col-md-6 actions text-right">
<div class="btn-group" id="gogs-repo-clone">
<button type="button" class="btn btn-default"><i class="fa fa-download fa-lg fa-m"></i></button>
- <button type="button" class="btn btn-default dropdown-toggle" data-container="body" data-toggle="popover" data-placement="bottom" data-content="<label>SSH:</label><div class='input-group'><input type='text' class='form-control' value='git@{{AppDomain}}:{{.Owner.LowerName}}/{{.Repository.Name}}.git'></div>" data-html="1">
+ <button type="button" class="btn btn-default dropdown-toggle" data-container="body" data-toggle="popover" data-placement="bottom" data-content="<label>SSH:</label><div class='input-group'><input type='text' class='form-control' value='{{.CloneLink.SSH}}'></div>" data-html="1">
<span class="caret"></span>
</button>
</div>