diff options
author | Unknwon <u@gogs.io> | 2017-07-18 22:09:57 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-07-18 22:09:57 -0400 |
commit | 643c85e9c8fd237912652d14a0535dfddf614d2b (patch) | |
tree | fa271da3516fcef381428613ef6150fec65d19be | |
parent | ee9950ec2f2811896918e74540fc6c3f40918daf (diff) |
routes/home: minor code improve
-rw-r--r-- | gogs.go | 2 | ||||
-rw-r--r-- | models/repo.go | 2 | ||||
-rw-r--r-- | routes/home.go | 16 | ||||
-rw-r--r-- | templates/.VERSION | 2 |
4 files changed, 11 insertions, 11 deletions
@@ -16,7 +16,7 @@ import ( "github.com/gogits/gogs/pkg/setting" ) -const APP_VER = "0.11.27.0718" +const APP_VER = "0.11.28.0718" func init() { setting.AppVer = APP_VER diff --git a/models/repo.go b/models/repo.go index dd04ac6e..998914d5 100644 --- a/models/repo.go +++ b/models/repo.go @@ -1634,7 +1634,7 @@ type SearchRepoOptions struct { // SearchRepositoryByName takes keyword and part of repository name to search, // it returns results in given range and number of total results. -func SearchRepositoryByName(opts *SearchRepoOptions) (repos []*Repository, _ int64, _ error) { +func SearchRepositoryByName(opts *SearchRepoOptions) (repos []*Repository, count int64, err error) { if opts.Page <= 0 { opts.Page = 1 } diff --git a/routes/home.go b/routes/home.go index 9c713391..29be6294 100644 --- a/routes/home.go +++ b/routes/home.go @@ -24,7 +24,7 @@ func Home(c *context.Context) { if c.IsLogged { if !c.User.IsActive && setting.Service.RegisterEmailConfirm { c.Data["Title"] = c.Tr("auth.active_your_account") - c.HTML(200, user.ACTIVATE) + c.Success(user.ACTIVATE) } else { user.Dashboard(c) } @@ -39,7 +39,7 @@ func Home(c *context.Context) { } c.Data["PageIsHome"] = true - c.HTML(200, HOME) + c.Success(HOME) } func ExploreRepos(c *context.Context) { @@ -61,7 +61,7 @@ func ExploreRepos(c *context.Context) { PageSize: setting.UI.ExplorePagingNum, }) if err != nil { - c.Handle(500, "SearchRepositoryByName", err) + c.ServerError("SearchRepositoryByName", err) return } c.Data["Keyword"] = keyword @@ -69,12 +69,12 @@ func ExploreRepos(c *context.Context) { c.Data["Page"] = paginater.New(int(count), setting.UI.ExplorePagingNum, page, 5) if err = models.RepositoryList(repos).LoadAttributes(); err != nil { - c.Handle(500, "LoadAttributes", err) + c.ServerError("RepositoryList.LoadAttributes", err) return } c.Data["Repos"] = repos - c.HTML(200, EXPLORE_REPOS) + c.Success(EXPLORE_REPOS) } type UserSearchOptions struct { @@ -102,7 +102,7 @@ func RenderUserSearch(c *context.Context, opts *UserSearchOptions) { if len(keyword) == 0 { users, err = opts.Ranger(page, opts.PageSize) if err != nil { - c.Handle(500, "opts.Ranger", err) + c.ServerError("Ranger", err) return } count = opts.Counter() @@ -115,7 +115,7 @@ func RenderUserSearch(c *context.Context, opts *UserSearchOptions) { PageSize: opts.PageSize, }) if err != nil { - c.Handle(500, "SearchUserByName", err) + c.ServerError("SearchUserByName", err) return } } @@ -124,7 +124,7 @@ func RenderUserSearch(c *context.Context, opts *UserSearchOptions) { c.Data["Page"] = paginater.New(int(count), opts.PageSize, page, 5) c.Data["Users"] = users - c.HTML(200, opts.TplName) + c.Success(opts.TplName) } func ExploreUsers(c *context.Context) { diff --git a/templates/.VERSION b/templates/.VERSION index b4c1f0c8..d3126a39 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.11.27.0718
\ No newline at end of file +0.11.28.0718
\ No newline at end of file |