summaryrefslogtreecommitdiffstats
path: root/routers/repo/release.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2016-11-24 15:04:31 +0800
committerGitHub <noreply@github.com>2016-11-24 15:04:31 +0800
commit3917ed45de063b4e8868610c82d8172020d572fd (patch)
tree052b7651cbb64ae30f92efe87441ad1d4fa2d922 /routers/repo/release.go
parent3a3782bb7fed768c1e832ff4c0a77f2f5281ed05 (diff)
downloadgitea-3917ed45de063b4e8868610c82d8172020d572fd.tar.gz
gitea-3917ed45de063b4e8868610c82d8172020d572fd.zip
golint fixed for routers (#208)
Diffstat (limited to 'routers/repo/release.go')
-rw-r--r--routers/repo/release.go26
1 files changed, 16 insertions, 10 deletions
diff --git a/routers/repo/release.go b/routers/repo/release.go
index 187952c2e6..7616d9e79e 100644
--- a/routers/repo/release.go
+++ b/routers/repo/release.go
@@ -17,8 +17,8 @@ import (
)
const (
- RELEASES base.TplName = "repo/release/list"
- RELEASE_NEW base.TplName = "repo/release/new"
+ tplReleases base.TplName = "repo/release/list"
+ tplReleaseNew base.TplName = "repo/release/new"
)
// calReleaseNumCommitsBehind calculates given release has how many commits behind release target.
@@ -49,6 +49,7 @@ func calReleaseNumCommitsBehind(repoCtx *context.Repository, release *models.Rel
return nil
}
+// Releases render releases list page
func Releases(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.release.releases")
ctx.Data["PageIsReleaseList"] = true
@@ -150,27 +151,29 @@ func Releases(ctx *context.Context) {
ctx.Data["Page"] = pager
models.SortReleases(tags)
ctx.Data["Releases"] = tags
- ctx.HTML(200, RELEASES)
+ ctx.HTML(200, tplReleases)
}
+// NewRelease render creating release page
func NewRelease(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.release.new_release")
ctx.Data["PageIsReleaseList"] = true
ctx.Data["tag_target"] = ctx.Repo.Repository.DefaultBranch
- ctx.HTML(200, RELEASE_NEW)
+ ctx.HTML(200, tplReleaseNew)
}
+// NewReleasePost response for creating a release
func NewReleasePost(ctx *context.Context, form auth.NewReleaseForm) {
ctx.Data["Title"] = ctx.Tr("repo.release.new_release")
ctx.Data["PageIsReleaseList"] = true
if ctx.HasError() {
- ctx.HTML(200, RELEASE_NEW)
+ ctx.HTML(200, tplReleaseNew)
return
}
if !ctx.Repo.GitRepo.IsBranchExist(form.Target) {
- ctx.RenderWithErr(ctx.Tr("form.target_branch_not_exist"), RELEASE_NEW, &form)
+ ctx.RenderWithErr(ctx.Tr("form.target_branch_not_exist"), tplReleaseNew, &form)
return
}
@@ -213,9 +216,9 @@ func NewReleasePost(ctx *context.Context, form auth.NewReleaseForm) {
ctx.Data["Err_TagName"] = true
switch {
case models.IsErrReleaseAlreadyExist(err):
- ctx.RenderWithErr(ctx.Tr("repo.release.tag_name_already_exist"), RELEASE_NEW, &form)
+ ctx.RenderWithErr(ctx.Tr("repo.release.tag_name_already_exist"), tplReleaseNew, &form)
case models.IsErrInvalidTagName(err):
- ctx.RenderWithErr(ctx.Tr("repo.release.tag_name_invalid"), RELEASE_NEW, &form)
+ ctx.RenderWithErr(ctx.Tr("repo.release.tag_name_invalid"), tplReleaseNew, &form)
default:
ctx.Handle(500, "CreateRelease", err)
}
@@ -226,6 +229,7 @@ func NewReleasePost(ctx *context.Context, form auth.NewReleaseForm) {
ctx.Redirect(ctx.Repo.RepoLink + "/releases")
}
+// EditRelease render release edit page
func EditRelease(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.release.edit_release")
ctx.Data["PageIsReleaseList"] = true
@@ -249,9 +253,10 @@ func EditRelease(ctx *context.Context) {
ctx.Data["prerelease"] = rel.IsPrerelease
ctx.Data["IsDraft"] = rel.IsDraft
- ctx.HTML(200, RELEASE_NEW)
+ ctx.HTML(200, tplReleaseNew)
}
+// EditReleasePost response for edit release
func EditReleasePost(ctx *context.Context, form auth.EditReleaseForm) {
ctx.Data["Title"] = ctx.Tr("repo.release.edit_release")
ctx.Data["PageIsReleaseList"] = true
@@ -274,7 +279,7 @@ func EditReleasePost(ctx *context.Context, form auth.EditReleaseForm) {
ctx.Data["prerelease"] = rel.IsPrerelease
if ctx.HasError() {
- ctx.HTML(200, RELEASE_NEW)
+ ctx.HTML(200, tplReleaseNew)
return
}
@@ -289,6 +294,7 @@ func EditReleasePost(ctx *context.Context, form auth.EditReleaseForm) {
ctx.Redirect(ctx.Repo.RepoLink + "/releases")
}
+// DeleteRelease delete a release
func DeleteRelease(ctx *context.Context) {
if err := models.DeleteReleaseByID(ctx.QueryInt64("id")); err != nil {
ctx.Flash.Error("DeleteReleaseByID: " + err.Error())