mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Use constants to name template file
This commit is contained in:
@@ -22,6 +22,16 @@ import (
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
)
|
||||
|
||||
const (
|
||||
ISSUES base.TplName = "repo/issue/list"
|
||||
ISSUE_CREATE base.TplName = "repo/issue/create"
|
||||
ISSUE_VIEW base.TplName = "repo/issue/view"
|
||||
|
||||
MILESTONE base.TplName = "repo/issue/milestone"
|
||||
MILESTONE_NEW base.TplName = "repo/issue/milestone_new"
|
||||
MILESTONE_EDIT base.TplName = "repo/issue/milestone_edit"
|
||||
)
|
||||
|
||||
func Issues(ctx *middleware.Context) {
|
||||
ctx.Data["Title"] = "Issues"
|
||||
ctx.Data["IsRepoToolbarIssues"] = true
|
||||
@@ -134,7 +144,7 @@ func Issues(ctx *middleware.Context) {
|
||||
} else {
|
||||
ctx.Data["ShowCount"] = issueStats.OpenCount
|
||||
}
|
||||
ctx.HTML(200, "issue/list")
|
||||
ctx.HTML(200, ISSUES)
|
||||
}
|
||||
|
||||
func CreateIssue(ctx *middleware.Context, params martini.Params) {
|
||||
@@ -161,7 +171,7 @@ func CreateIssue(ctx *middleware.Context, params martini.Params) {
|
||||
return
|
||||
}
|
||||
ctx.Data["Collaborators"] = us
|
||||
ctx.HTML(200, "issue/create")
|
||||
ctx.HTML(200, ISSUE_CREATE)
|
||||
}
|
||||
|
||||
func CreateIssuePost(ctx *middleware.Context, params martini.Params, form auth.CreateIssueForm) {
|
||||
@@ -190,7 +200,7 @@ func CreateIssuePost(ctx *middleware.Context, params martini.Params, form auth.C
|
||||
ctx.Data["Collaborators"] = us
|
||||
|
||||
if ctx.HasError() {
|
||||
ctx.HTML(200, "issue/create")
|
||||
ctx.HTML(200, ISSUE_CREATE)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -392,7 +402,7 @@ func ViewIssue(ctx *middleware.Context, params martini.Params) {
|
||||
ctx.Data["IsIssueOwner"] = ctx.Repo.IsOwner || (ctx.IsSigned && issue.PosterId == ctx.User.Id)
|
||||
ctx.Data["IsRepoToolbarIssues"] = true
|
||||
ctx.Data["IsRepoToolbarIssuesList"] = false
|
||||
ctx.HTML(200, "issue/view")
|
||||
ctx.HTML(200, ISSUE_VIEW)
|
||||
}
|
||||
|
||||
func UpdateIssue(ctx *middleware.Context, params martini.Params, form auth.CreateIssueForm) {
|
||||
@@ -794,14 +804,14 @@ func Milestones(ctx *middleware.Context) {
|
||||
} else {
|
||||
ctx.Data["State"] = "open"
|
||||
}
|
||||
ctx.HTML(200, "issue/milestone")
|
||||
ctx.HTML(200, MILESTONE)
|
||||
}
|
||||
|
||||
func NewMilestone(ctx *middleware.Context) {
|
||||
ctx.Data["Title"] = "New Milestone"
|
||||
ctx.Data["IsRepoToolbarIssues"] = true
|
||||
ctx.Data["IsRepoToolbarIssuesList"] = true
|
||||
ctx.HTML(200, "issue/milestone_new")
|
||||
ctx.HTML(200, MILESTONE_NEW)
|
||||
}
|
||||
|
||||
func NewMilestonePost(ctx *middleware.Context, form auth.CreateMilestoneForm) {
|
||||
@@ -809,6 +819,11 @@ func NewMilestonePost(ctx *middleware.Context, form auth.CreateMilestoneForm) {
|
||||
ctx.Data["IsRepoToolbarIssues"] = true
|
||||
ctx.Data["IsRepoToolbarIssuesList"] = true
|
||||
|
||||
if ctx.HasError() {
|
||||
ctx.HTML(200, MILESTONE_NEW)
|
||||
return
|
||||
}
|
||||
|
||||
var deadline time.Time
|
||||
var err error
|
||||
if len(form.Deadline) == 0 {
|
||||
@@ -890,7 +905,7 @@ func UpdateMilestone(ctx *middleware.Context, params martini.Params) {
|
||||
}
|
||||
ctx.Data["Milestone"] = mile
|
||||
|
||||
ctx.HTML(200, "issue/milestone_edit")
|
||||
ctx.HTML(200, MILESTONE_EDIT)
|
||||
}
|
||||
|
||||
func UpdateMilestonePost(ctx *middleware.Context, params martini.Params, form auth.CreateMilestoneForm) {
|
||||
@@ -914,6 +929,11 @@ func UpdateMilestonePost(ctx *middleware.Context, params martini.Params, form au
|
||||
return
|
||||
}
|
||||
|
||||
if ctx.HasError() {
|
||||
ctx.HTML(200, MILESTONE_EDIT)
|
||||
return
|
||||
}
|
||||
|
||||
var deadline time.Time
|
||||
if len(form.Deadline) == 0 {
|
||||
form.Deadline = "12/31/9999"
|
||||
|
Reference in New Issue
Block a user