diff options
author | Unknwon <u@gogs.io> | 2016-07-24 00:23:54 +0800 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-07-24 00:23:54 +0800 |
commit | 46e96c008cf966428c9dad71c7871de88186e3fe (patch) | |
tree | 57e276d8f971c74a6dac841352ec2bee96e93d8f /routers | |
parent | 256cd6374adf646a46265efe18a2d3f822bf7269 (diff) | |
download | gitea-46e96c008cf966428c9dad71c7871de88186e3fe.tar.gz gitea-46e96c008cf966428c9dad71c7871de88186e3fe.zip |
Use struct for UI settings
Diffstat (limited to 'routers')
-rw-r--r-- | routers/admin/notice.go | 4 | ||||
-rw-r--r-- | routers/admin/orgs.go | 2 | ||||
-rw-r--r-- | routers/admin/repos.go | 2 | ||||
-rw-r--r-- | routers/admin/users.go | 2 | ||||
-rw-r--r-- | routers/api/v1/repo/issue.go | 2 | ||||
-rw-r--r-- | routers/home.go | 4 | ||||
-rw-r--r-- | routers/repo/issue.go | 4 | ||||
-rw-r--r-- | routers/repo/view.go | 2 | ||||
-rw-r--r-- | routers/user/home.go | 2 |
9 files changed, 12 insertions, 12 deletions
diff --git a/routers/admin/notice.go b/routers/admin/notice.go index 09222eb84e..5d4e807ee4 100644 --- a/routers/admin/notice.go +++ b/routers/admin/notice.go @@ -29,9 +29,9 @@ func Notices(ctx *context.Context) { if page <= 1 { page = 1 } - ctx.Data["Page"] = paginater.New(int(total), setting.AdminNoticePagingNum, page, 5) + ctx.Data["Page"] = paginater.New(int(total), setting.UI.Admin.NoticePagingNum, page, 5) - notices, err := models.Notices(page, setting.AdminNoticePagingNum) + notices, err := models.Notices(page, setting.UI.Admin.NoticePagingNum) if err != nil { ctx.Handle(500, "Notices", err) return diff --git a/routers/admin/orgs.go b/routers/admin/orgs.go index 28e9d79f06..3200072107 100644 --- a/routers/admin/orgs.go +++ b/routers/admin/orgs.go @@ -25,7 +25,7 @@ func Organizations(ctx *context.Context) { Type: models.USER_TYPE_ORGANIZATION, Counter: models.CountOrganizations, Ranger: models.Organizations, - PageSize: setting.AdminOrgPagingNum, + PageSize: setting.UI.Admin.OrgPagingNum, OrderBy: "id ASC", TplName: ORGS, }) diff --git a/routers/admin/repos.go b/routers/admin/repos.go index 8b5caa8d72..dc259c634f 100644 --- a/routers/admin/repos.go +++ b/routers/admin/repos.go @@ -26,7 +26,7 @@ func Repos(ctx *context.Context) { Counter: models.CountRepositories, Ranger: models.Repositories, Private: true, - PageSize: setting.AdminRepoPagingNum, + PageSize: setting.UI.Admin.RepoPagingNum, OrderBy: "id ASC", TplName: REPOS, }) diff --git a/routers/admin/users.go b/routers/admin/users.go index 9b017fa532..b7056957e9 100644 --- a/routers/admin/users.go +++ b/routers/admin/users.go @@ -33,7 +33,7 @@ func Users(ctx *context.Context) { Type: models.USER_TYPE_INDIVIDUAL, Counter: models.CountUsers, Ranger: models.Users, - PageSize: setting.AdminUserPagingNum, + PageSize: setting.UI.Admin.UserPagingNum, OrderBy: "id ASC", TplName: USERS, }) diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go index bf2c8e9ddf..a3f69d3f81 100644 --- a/routers/api/v1/repo/issue.go +++ b/routers/api/v1/repo/issue.go @@ -31,7 +31,7 @@ func ListIssues(ctx *context.APIContext) { apiIssues[i] = convert.ToIssue(issues[i]) } - ctx.SetLinkHeader(ctx.Repo.Repository.NumIssues, setting.IssuePagingNum) + ctx.SetLinkHeader(ctx.Repo.Repository.NumIssues, setting.UI.IssuePagingNum) ctx.JSON(200, &apiIssues) } diff --git a/routers/home.go b/routers/home.go index 16967521d7..93b24083c7 100644 --- a/routers/home.go +++ b/routers/home.go @@ -109,7 +109,7 @@ func ExploreRepos(ctx *context.Context) { RenderRepoSearch(ctx, &RepoSearchOptions{ Counter: models.CountPublicRepositories, Ranger: models.GetRecentUpdatedRepositories, - PageSize: setting.ExplorePagingNum, + PageSize: setting.UI.ExplorePagingNum, OrderBy: "updated_unix DESC", TplName: EXPLORE_REPOS, }) @@ -174,7 +174,7 @@ func ExploreUsers(ctx *context.Context) { Type: models.USER_TYPE_INDIVIDUAL, Counter: models.CountUsers, Ranger: models.Users, - PageSize: setting.ExplorePagingNum, + PageSize: setting.UI.ExplorePagingNum, OrderBy: "updated_unix DESC", TplName: EXPLORE_USERS, }) diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 52524297da..1562845bad 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -163,7 +163,7 @@ func Issues(ctx *context.Context) { } else { total = int(issueStats.ClosedCount) } - pager := paginater.New(total, setting.IssuePagingNum, page, 5) + pager := paginater.New(total, setting.UI.IssuePagingNum, page, 5) ctx.Data["Page"] = pager // Get issues. @@ -1017,7 +1017,7 @@ func Milestones(ctx *context.Context) { } else { total = int(closedCount) } - ctx.Data["Page"] = paginater.New(total, setting.IssuePagingNum, page, 5) + ctx.Data["Page"] = paginater.New(total, setting.UI.IssuePagingNum, page, 5) miles, err := models.GetMilestones(ctx.Repo.Repository.ID, page, isShowClosed) if err != nil { diff --git a/routers/repo/view.go b/routers/repo/view.go index e787879d86..7bcdc1293c 100644 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -105,7 +105,7 @@ func Home(ctx *context.Context) { case isImageFile: ctx.Data["IsImageFile"] = true case isTextFile: - if blob.Size() >= setting.MaxDisplayFileSize { + if blob.Size() >= setting.UI.MaxDisplayFileSize { ctx.Data["IsFileTooLarge"] = true } else { ctx.Data["IsFileTooLarge"] = false diff --git a/routers/user/home.go b/routers/user/home.go index eb6a6f099b..aaf660d48a 100644 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -253,7 +253,7 @@ func Issues(ctx *context.Context) { } else { total = int(issueStats.ClosedCount) } - ctx.Data["Page"] = paginater.New(total, setting.IssuePagingNum, page, 5) + ctx.Data["Page"] = paginater.New(total, setting.UI.IssuePagingNum, page, 5) // Get issues. issues, err := models.Issues(&models.IssuesOptions{ |