mirror of
1
Fork 0
This commit is contained in:
Unknown 2014-03-27 21:15:53 -04:00
parent 8b700e825b
commit 5344a03003
4 changed files with 10 additions and 3 deletions

View File

@ -56,7 +56,9 @@ func RepoAssignment(redirect bool) martini.Handler {
// get repository
repo, err := models.GetRepositoryByName(user.Id, params["reponame"])
if err != nil {
if redirect {
if err == models.ErrRepoNotExist {
ctx.Handle(404, "RepoAssignment", err)
} else if redirect {
ctx.Redirect("/")
return
}

View File

@ -6,6 +6,7 @@ package repo
import (
"fmt"
"net/url"
"github.com/codegangsta/martini"
@ -35,7 +36,9 @@ func Issues(ctx *middleware.Context) {
var posterId int64 = 0
if ctx.Query("type") == "created_by" {
if !ctx.IsSigned {
ctx.SetCookie("redirect_to", "/"+url.QueryEscape(ctx.Req.RequestURI))
ctx.Redirect("/user/login/", 302)
return
}
posterId = ctx.User.Id
ctx.Data["ViewType"] = "created_by"

View File

@ -85,9 +85,11 @@ func Single(ctx *middleware.Context, params martini.Params) {
ctx.Data["Branches"] = brs
var commitId string
if !models.IsBranchExist(userName, repoName, branchName) {
isViewBranch := models.IsBranchExist(userName, repoName, branchName)
if !isViewBranch {
commitId = branchName
}
ctx.Data["IsViewBranch"] = isViewBranch
repoFile, err := models.GetTargetFile(userName, repoName,
branchName, commitId, treename)

View File

@ -5,7 +5,7 @@
<ul class="nav navbar-nav">
<li class="{{if .IsRepoToolbarSource}}active{{end}}"><a href="/{{.RepositoryLink}}">Source</a></li>
{{if not .IsBareRepo}}
<li class="{{if .IsRepoToolbarCommits}}active{{end}}"><a href="/{{.RepositoryLink}}/commits/{{.Branchname}}">Commits</a></li>
{{if .IsViewBranch}}<li class="{{if .IsRepoToolbarCommits}}active{{end}}"><a href="/{{.RepositoryLink}}/commits/{{.Branchname}}">Commits</a></li>{{end}}
<!-- <li class="{{if .IsRepoToolbarBranches}}active{{end}}"><a href="/{{.RepositoryLink}}/branches">Branches</a></li> -->
<!-- <li class="{{if .IsRepoToolbarPulls}}active{{end}}"><a href="/{{.RepositoryLink}}/pulls">Pull Requests</a></li> -->
<li class="{{if .IsRepoToolbarIssues}}active{{end}}"><a href="/{{.RepositoryLink}}/issues">Issues <!--<span class="badge">42</span>--></a></li>