summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2016-11-21 18:03:29 +0800
committerGitHub <noreply@github.com>2016-11-21 18:03:29 +0800
commit18dc4f1023c4f343ad992d3cedab39a244d4178d (patch)
tree8ef9dc5dcea9cfa915732ea4a796c38284a0af4a /routers
parent1d9576d5ea334556400926a0218acfebb59523df (diff)
downloadgitea-18dc4f1023c4f343ad992d3cedab39a244d4178d.tar.gz
gitea-18dc4f1023c4f343ad992d3cedab39a244d4178d.zip
golint fixed for routers/repo/view.go (#205)
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/view.go19
1 files changed, 12 insertions, 7 deletions
diff --git a/routers/repo/view.go b/routers/repo/view.go
index 8f49a12c32..7303e44126 100644
--- a/routers/repo/view.go
+++ b/routers/repo/view.go
@@ -25,9 +25,9 @@ import (
)
const (
- HOME base.TplName = "repo/home"
- WATCHERS base.TplName = "repo/watchers"
- FORKS base.TplName = "repo/forks"
+ tplRepoHome base.TplName = "repo/home"
+ tplWatchers base.TplName = "repo/watchers"
+ tplForks base.TplName = "repo/forks"
)
func renderDirectory(ctx *context.Context, treeLink string) {
@@ -212,6 +212,7 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st
}
}
+// Home render repository home page
func Home(ctx *context.Context) {
title := ctx.Repo.Repository.Owner.Name + "/" + ctx.Repo.Repository.Name
if len(ctx.Repo.Repository.Description) > 0 {
@@ -263,9 +264,10 @@ func Home(ctx *context.Context) {
ctx.Data["TreeLink"] = treeLink
ctx.Data["TreeNames"] = treeNames
ctx.Data["BranchLink"] = branchLink
- ctx.HTML(200, HOME)
+ ctx.HTML(200, tplRepoHome)
}
+// RenderUserCards render a page show users accroding the input templaet
func RenderUserCards(ctx *context.Context, total int, getter func(page int) ([]*models.User, error), tpl base.TplName) {
page := ctx.QueryInt("page")
if page <= 0 {
@@ -284,20 +286,23 @@ func RenderUserCards(ctx *context.Context, total int, getter func(page int) ([]*
ctx.HTML(200, tpl)
}
+// Watchers render repository's watch users
func Watchers(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.watchers")
ctx.Data["CardsTitle"] = ctx.Tr("repo.watchers")
ctx.Data["PageIsWatchers"] = true
- RenderUserCards(ctx, ctx.Repo.Repository.NumWatches, ctx.Repo.Repository.GetWatchers, WATCHERS)
+ RenderUserCards(ctx, ctx.Repo.Repository.NumWatches, ctx.Repo.Repository.GetWatchers, tplWatchers)
}
+// Stars render repository's starred users
func Stars(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.stargazers")
ctx.Data["CardsTitle"] = ctx.Tr("repo.stargazers")
ctx.Data["PageIsStargazers"] = true
- RenderUserCards(ctx, ctx.Repo.Repository.NumStars, ctx.Repo.Repository.GetStargazers, WATCHERS)
+ RenderUserCards(ctx, ctx.Repo.Repository.NumStars, ctx.Repo.Repository.GetStargazers, tplWatchers)
}
+// Forks render repository's forked users
func Forks(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repos.forks")
@@ -315,5 +320,5 @@ func Forks(ctx *context.Context) {
}
ctx.Data["Forks"] = forks
- ctx.HTML(200, FORKS)
+ ctx.HTML(200, tplForks)
}