mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-26 01:40:36 +00:00
golint fixed for routers/repo/view.go (#205)
This commit is contained in:
parent
1d9576d5ea
commit
18dc4f1023
1 changed files with 12 additions and 7 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue