summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gogs.go2
-rw-r--r--modules/auth/issue.go9
-rw-r--r--modules/avatar/avatar.go3
-rw-r--r--modules/base/tool.go5
-rw-r--r--modules/middleware/repo.go5
-rw-r--r--routers/repo/branch.go5
-rw-r--r--routers/repo/issue.go11
-rw-r--r--routers/repo/pull.go5
-rw-r--r--routers/repo/repo.go14
-rw-r--r--serve.go5
-rw-r--r--templates/issue/create.tmpl9
-rw-r--r--templates/issue/list.tmpl (renamed from templates/issue/repo.tmpl)5
-rw-r--r--templates/repo/nav.tmpl2
-rw-r--r--web.go6
14 files changed, 34 insertions, 52 deletions
diff --git a/gogs.go b/gogs.go
index 7ac699cc69..b62580f8fd 100644
--- a/gogs.go
+++ b/gogs.go
@@ -19,7 +19,7 @@ import (
// Test that go1.2 tag above is included in builds. main.go refers to this definition.
const go12tag = true
-const APP_VER = "0.1.7.0324"
+const APP_VER = "0.1.7.0325"
func init() {
base.AppVer = APP_VER
diff --git a/modules/auth/issue.go b/modules/auth/issue.go
index e2b1f9f2a7..8bf49684c6 100644
--- a/modules/auth/issue.go
+++ b/modules/auth/issue.go
@@ -17,9 +17,8 @@ import (
)
type CreateIssueForm struct {
- IssueName string `form:"name" binding:"Required;MaxSize(50)"`
- RepoId int64 `form:"repoid" binding:"Required"`
- MilestoneId int64 `form:"milestoneid" binding:"Required"`
+ IssueName string `form:"title" binding:"Required;MaxSize(50)"`
+ MilestoneId int64 `form:"milestoneid"`
AssigneeId int64 `form:"assigneeid"`
Labels string `form:"labels"`
Content string `form:"content"`
@@ -27,9 +26,7 @@ type CreateIssueForm struct {
func (f *CreateIssueForm) Name(field string) string {
names := map[string]string{
- "IssueName": "Issue name",
- "RepoId": "Repository ID",
- "MilestoneId": "Milestone ID",
+ "IssueName": "Issue name",
}
return names[field]
}
diff --git a/modules/avatar/avatar.go b/modules/avatar/avatar.go
index 3b423a6d15..449c9656dc 100644
--- a/modules/avatar/avatar.go
+++ b/modules/avatar/avatar.go
@@ -30,8 +30,9 @@ import (
"sync"
"time"
- "github.com/gogits/gogs/modules/log"
"github.com/nfnt/resize"
+
+ "github.com/gogits/gogs/modules/log"
)
var (
diff --git a/modules/base/tool.go b/modules/base/tool.go
index 0dec7aa8dd..c23f5de6cc 100644
--- a/modules/base/tool.go
+++ b/modules/base/tool.go
@@ -102,7 +102,10 @@ func CreateTimeLimitCode(data string, minutes int, startInf interface{}) string
// AvatarLink returns avatar link by given e-mail.
func AvatarLink(email string) string {
- return "/avatar/" + EncodeMd5(email)
+ if Service.EnableCacheAvatar {
+ return "/avatar/" + EncodeMd5(email)
+ }
+ return "http://1.gravatar.com/avatar/" + EncodeMd5(email)
}
// Seconds-based time units
diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go
index b23bccb104..bc90c05cc7 100644
--- a/modules/middleware/repo.go
+++ b/modules/middleware/repo.go
@@ -76,6 +76,11 @@ func RepoAssignment(redirect bool) martini.Handler {
ctx.Repo.CloneLink.SSH = fmt.Sprintf("%s@%s:%s/%s.git", base.RunUser, base.Domain, user.LowerName, repo.LowerName)
ctx.Repo.CloneLink.HTTPS = fmt.Sprintf("%s://%s/%s/%s.git", scheme, base.Domain, user.LowerName, repo.LowerName)
+ if len(params["branchname"]) == 0 {
+ params["branchname"] = "master"
+ }
+ ctx.Data["Branchname"] = params["branchname"]
+
ctx.Data["IsRepositoryValid"] = true
ctx.Data["Repository"] = repo
ctx.Data["Owner"] = user
diff --git a/routers/repo/branch.go b/routers/repo/branch.go
index 8c953f2ede..aed77cfaa5 100644
--- a/routers/repo/branch.go
+++ b/routers/repo/branch.go
@@ -26,11 +26,6 @@ func Branches(ctx *middleware.Context, params martini.Params) {
ctx.Data["Username"] = params["username"]
ctx.Data["Reponame"] = params["reponame"]
-
- if len(params["branchname"]) == 0 {
- params["branchname"] = "master"
- }
- ctx.Data["Branchname"] = params["branchname"]
ctx.Data["Branches"] = brs
ctx.Data["IsRepoToolbarBranches"] = true
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index ab070d724c..4e8324605c 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -30,12 +30,7 @@ func Issues(ctx *middleware.Context, params martini.Params) {
ctx.Handle(200, "issue.Issues: %v", err)
return
}
-
- if len(params["branchname"]) == 0 {
- params["branchname"] = "master"
- }
- ctx.Data["Branchname"] = params["branchname"]
- ctx.HTML(200, "issue/repo")
+ ctx.HTML(200, "issue/list")
}
func CreateIssue(ctx *middleware.Context, params martini.Params, form auth.CreateIssueForm) {
@@ -57,10 +52,10 @@ func CreateIssue(ctx *middleware.Context, params martini.Params, form auth.Creat
return
}
- issue, err := models.CreateIssue(ctx.User.Id, form.RepoId, form.MilestoneId, form.AssigneeId,
+ issue, err := models.CreateIssue(ctx.User.Id, ctx.Repo.Repository.Id, form.MilestoneId, form.AssigneeId,
form.IssueName, form.Labels, form.Content, false)
if err == nil {
- log.Trace("%s Issue created: %d", form.RepoId, issue.Id)
+ log.Trace("%d Issue created: %d", ctx.Repo.Repository.Id, issue.Id)
ctx.Redirect(fmt.Sprintf("/%s/%s/issues/%d", params["username"], params["reponame"], issue.Index))
return
}
diff --git a/routers/repo/pull.go b/routers/repo/pull.go
index 16c60389da..93b6a9f7cc 100644
--- a/routers/repo/pull.go
+++ b/routers/repo/pull.go
@@ -12,10 +12,5 @@ import (
func Pulls(ctx *middleware.Context, params martini.Params) {
ctx.Data["IsRepoToolbarPulls"] = true
- if len(params["branchname"]) == 0 {
- params["branchname"] = "master"
- }
-
- ctx.Data["Branchname"] = params["branchname"]
ctx.HTML(200, "repo/pulls")
}
diff --git a/routers/repo/repo.go b/routers/repo/repo.go
index cd28d52caa..acf025a284 100644
--- a/routers/repo/repo.go
+++ b/routers/repo/repo.go
@@ -57,10 +57,6 @@ func Single(ctx *middleware.Context, params martini.Params) {
return
}
- if len(params["branchname"]) == 0 {
- params["branchname"] = "master"
- }
-
// Get tree path
treename := params["_1"]
@@ -177,7 +173,6 @@ func Single(ctx *middleware.Context, params martini.Params) {
ctx.Data["Username"] = params["username"]
ctx.Data["Reponame"] = params["reponame"]
- ctx.Data["Branchname"] = params["branchname"]
var treenames []string
Paths := make([]string, 0)
@@ -216,10 +211,6 @@ func SingleDownload(ctx *middleware.Context, params martini.Params) {
return
}
- if len(params["branchname"]) == 0 {
- params["branchname"] = "master"
- }
-
// Get tree path
treename := params["_1"]
@@ -290,11 +281,6 @@ func Setting(ctx *middleware.Context, params martini.Params) {
title = t
}
- if len(params["branchname"]) == 0 {
- params["branchname"] = "master"
- }
-
- ctx.Data["Branchname"] = params["branchname"]
ctx.Data["Title"] = title + " - settings"
ctx.HTML(200, "repo/setting")
}
diff --git a/serve.go b/serve.go
index bfd2663fc6..25a34efbaf 100644
--- a/serve.go
+++ b/serve.go
@@ -249,8 +249,8 @@ func runServ(k *cli.Context) {
}
}
if refname == "" {
- println("No find any reference name:", b.String())
- log.Error("No find any reference name: " + b.String())
+ println("Not found any reference name:", b.String())
+ log.Error("Not found any reference name: " + b.String())
return
}
@@ -268,7 +268,6 @@ func runServ(k *cli.Context) {
}
if ref, ok = refs[refname]; !ok {
log.Error("unknow reference name -", refname, "-", b.String())
- log.Error("unknow reference name -", refname, "-", b.String())
return
}
l, err = ref.AllCommits()
diff --git a/templates/issue/create.tmpl b/templates/issue/create.tmpl
index 34c7f40aa3..cbc21f6ce0 100644
--- a/templates/issue/create.tmpl
+++ b/templates/issue/create.tmpl
@@ -4,13 +4,14 @@
{{template "repo/toolbar" .}}
<div id="body" class="container">
<div id="issue">
- <form class="form" action="#" method="post" id="issue-create-form">
+ <form class="form" action="/{{.RepositoryLink}}/issues/new" method="post" id="issue-create-form">
+ {{.CsrfTokenHtml}}
<div class="col-md-1">
- <img class="avatar" src="http://tp2.sinaimg.cn/5068084885/50/40050297589/1" alt=""/>
+ <img class="avatar" src="{{.SignedUser.AvatarLink}}" alt=""/>
</div>
<div class="col-md-8 panel panel-default">
<div class="form-group panel-body">
- <input class="form-control input-lg" type="text" name="title" required="required" placeholder="Title"/>
+ <input class="form-control input-lg" type="text" name="title" required="required" placeholder="Title" value="{{.title}}" />
</div>
<div class="form-group panel-body">
<div class="md-help pull-right"><!-- todo help link -->
@@ -23,7 +24,7 @@
<div class="tab-content">
<div class="tab-pane" id="issue-textarea">
<div class="form-group">
- <textarea class="form-control" name="content" id="issue-content" rows="10" placeholder="Write some content"></textarea>
+ <textarea class="form-control" name="content" id="issue-content" rows="10" placeholder="Write some content">{{.content}}</textarea>
</div>
</div>
<div class="tab-pane" id="issue-preview">preview</div>
diff --git a/templates/issue/repo.tmpl b/templates/issue/list.tmpl
index c348f27ff6..685eaeeb96 100644
--- a/templates/issue/repo.tmpl
+++ b/templates/issue/list.tmpl
@@ -19,6 +19,11 @@
</div>
</div>
<div class="issues list-group">
+ {{range .Issues}}
+ <div class="list-group-item issue-item" id="{{.Id}}"></div>
+ {{end}}
+ </div>
+ <div class="issues list-group">
<div class="list-group-item unread issue-item" id="issue-id">
<span class="number pull-right">#123</span>
<h5 class="title"><a href="#">Bug: When running tests after generating a beego app, templates do not load.</a></h5>
diff --git a/templates/repo/nav.tmpl b/templates/repo/nav.tmpl
index e1b22b1c93..02096c34c1 100644
--- a/templates/repo/nav.tmpl
+++ b/templates/repo/nav.tmpl
@@ -2,7 +2,7 @@
<div class="container">
<div class="row">
<div class="col-md-7">
- <h3 class="name"><i class="fa fa-book fa-lg"></i><a href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a> / {{.Repository.Name}}</h3>
+ <h3 class="name"><i class="fa fa-book fa-lg"></i><a href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a> / <a href="/{{.Owner.Name}}/{{.Repository.Name}}">{{.Repository.Name}}</a></h3>
<p class="desc">{{.Repository.Description}}{{if .Repository.Website}} <a href="{{.Repository.Website}}">{{.Repository.Website}}</a>{{end}}</p>
</div>
<div class="col-md-5 actions text-right clone-group-btn">
diff --git a/web.go b/web.go
index 6538c61f19..9b7b21639a 100644
--- a/web.go
+++ b/web.go
@@ -90,7 +90,7 @@ func runWeb(*cli.Context) {
// Routers.
m.Get("/", ignSignIn, routers.Home)
- m.Get("/install",routers.Install)
+ m.Get("/install", routers.Install)
m.Get("/issues", reqSignIn, user.Issues)
m.Get("/pulls", reqSignIn, user.Pulls)
m.Get("/stars", reqSignIn, user.Stars)
@@ -142,13 +142,13 @@ func runWeb(*cli.Context) {
r.Post("/settings", repo.SettingPost)
r.Get("/settings", repo.Setting)
r.Get("/action/:action", repo.Action)
+ r.Any("/issues/new", binding.BindIgnErr(auth.CreateIssueForm{}), repo.CreateIssue)
+ r.Post("/issues/:index", binding.BindIgnErr(auth.CreateIssueForm{}), repo.UpdateIssue)
}, reqSignIn, middleware.RepoAssignment(true))
m.Group("/:username/:reponame", func(r martini.Router) {
r.Get("/commits/:branchname", repo.Commits)
r.Get("/issues", repo.Issues)
- r.Any("/issues/new", binding.BindIgnErr(auth.CreateIssueForm{}), repo.CreateIssue)
r.Get("/issues/:index", repo.ViewIssue)
- r.Post("/issues/:index", binding.BindIgnErr(auth.CreateIssueForm{}), repo.UpdateIssue)
r.Get("/pulls", repo.Pulls)
r.Get("/branches", repo.Branches)
r.Get("/src/:branchname", repo.Single)