diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2016-11-18 11:03:03 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-18 11:03:03 +0800 |
commit | cf045b029cc11dc48c3a626441b7017710088823 (patch) | |
tree | f234f8ad8b8a548bda4c9d372ca5b9af95b0b40b /routers/home.go | |
parent | 91953ae9b421300eef79d58891dec7f2026e5d53 (diff) | |
download | gitea-cf045b029cc11dc48c3a626441b7017710088823.tar.gz gitea-cf045b029cc11dc48c3a626441b7017710088823.zip |
golint fixed for parts of routers root, dev, user and org dirs (#167)
* golint fixed for parts of routers root, dev and org dirs
* add user/auth.go golint fixed
* rename unnecessary exported to unexported and user dir golint fixed
Diffstat (limited to 'routers/home.go')
-rw-r--r-- | routers/home.go | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/routers/home.go b/routers/home.go index 108c857e60..ee425a830e 100644 --- a/routers/home.go +++ b/routers/home.go @@ -17,17 +17,22 @@ import ( ) const ( - HOME base.TplName = "home" - EXPLORE_REPOS base.TplName = "explore/repos" - EXPLORE_USERS base.TplName = "explore/users" - EXPLORE_ORGANIZATIONS base.TplName = "explore/organizations" + // tplHome home page template + tplHome base.TplName = "home" + // tplExploreRepos explore repositories page template + tplExploreRepos base.TplName = "explore/repos" + // tplExploreUsers explore users page template + tplExploreUsers base.TplName = "explore/users" + // tplExploreOrganizations explore organizations page template + tplExploreOrganizations base.TplName = "explore/organizations" ) +// Home render home page func Home(ctx *context.Context) { if ctx.IsSigned { if !ctx.User.IsActive && setting.Service.RegisterEmailConfirm { ctx.Data["Title"] = ctx.Tr("auth.active_your_account") - ctx.HTML(200, user.ACTIVATE) + ctx.HTML(200, user.TplActivate) } else { user.Dashboard(ctx) } @@ -42,9 +47,10 @@ func Home(ctx *context.Context) { } ctx.Data["PageIsHome"] = true - ctx.HTML(200, HOME) + ctx.HTML(200, tplHome) } +// RepoSearchOptions when calling search repositories type RepoSearchOptions struct { Counter func(bool) int64 Ranger func(int, int) ([]*models.Repository, error) @@ -54,6 +60,7 @@ type RepoSearchOptions struct { TplName base.TplName } +// RenderRepoSearch render repositories search page func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) { page := ctx.QueryInt("page") if page <= 0 { @@ -102,6 +109,7 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) { ctx.HTML(200, opts.TplName) } +// ExploreRepos render explore repositories page func ExploreRepos(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("explore") ctx.Data["PageIsExplore"] = true @@ -112,10 +120,11 @@ func ExploreRepos(ctx *context.Context) { Ranger: models.GetRecentUpdatedRepositories, PageSize: setting.UI.ExplorePagingNum, OrderBy: "updated_unix DESC", - TplName: EXPLORE_REPOS, + TplName: tplExploreRepos, }) } +// UserSearchOptions options when render search user page type UserSearchOptions struct { Type models.UserType Counter func() int64 @@ -125,6 +134,7 @@ type UserSearchOptions struct { TplName base.TplName } +// RenderUserSearch render user search page func RenderUserSearch(ctx *context.Context, opts *UserSearchOptions) { page := ctx.QueryInt("page") if page <= 1 { @@ -166,6 +176,7 @@ func RenderUserSearch(ctx *context.Context, opts *UserSearchOptions) { ctx.HTML(200, opts.TplName) } +// ExploreUsers render explore users page func ExploreUsers(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("explore") ctx.Data["PageIsExplore"] = true @@ -177,10 +188,11 @@ func ExploreUsers(ctx *context.Context) { Ranger: models.Users, PageSize: setting.UI.ExplorePagingNum, OrderBy: "name ASC", - TplName: EXPLORE_USERS, + TplName: tplExploreUsers, }) } +// ExploreOrganizations render explore organizations page func ExploreOrganizations(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("explore") ctx.Data["PageIsExplore"] = true @@ -192,10 +204,11 @@ func ExploreOrganizations(ctx *context.Context) { Ranger: models.Organizations, PageSize: setting.UI.ExplorePagingNum, OrderBy: "name ASC", - TplName: EXPLORE_ORGANIZATIONS, + TplName: tplExploreOrganizations, }) } +// NotFound render 404 page func NotFound(ctx *context.Context) { ctx.Data["Title"] = "Page Not Found" ctx.Handle(404, "home.NotFound", nil) |