|
|
@@ -9,10 +9,7 @@ package admin
|
|
|
import (
|
|
|
"gitote/gitote/models"
|
|
|
"gitote/gitote/pkg/context"
|
|
|
- "gitote/gitote/pkg/setting"
|
|
|
"gitote/gitote/routes"
|
|
|
-
|
|
|
- "gitlab.com/yoginth/paginater"
|
|
|
)
|
|
|
|
|
|
const (
|
|
|
@@ -51,9 +48,6 @@ func OrgSitemap(c *context.Context) {
|
|
|
// RepoSitemap shows about page
|
|
|
func RepoSitemap(c *context.Context) {
|
|
|
page := c.QueryInt("page")
|
|
|
- if page <= 0 {
|
|
|
- page = 1
|
|
|
- }
|
|
|
|
|
|
var (
|
|
|
repos []*models.Repository
|
|
|
@@ -61,29 +55,13 @@ func RepoSitemap(c *context.Context) {
|
|
|
err error
|
|
|
)
|
|
|
|
|
|
- keyword := c.Query("q")
|
|
|
- if len(keyword) == 0 {
|
|
|
- repos, err = models.Repositories(page, setting.UI.Admin.RepoPagingNum)
|
|
|
- if err != nil {
|
|
|
- c.Handle(500, "Repositories", err)
|
|
|
- return
|
|
|
- }
|
|
|
- count = models.CountRepositories(true)
|
|
|
- } else {
|
|
|
- repos, count, err = models.SearchRepositoryByName(&models.SearchRepoOptions{
|
|
|
- Keyword: keyword,
|
|
|
- OrderBy: "id ASC",
|
|
|
- Private: true,
|
|
|
- Page: page,
|
|
|
- })
|
|
|
- if err != nil {
|
|
|
- c.Handle(500, "SearchRepositoryByName", err)
|
|
|
- return
|
|
|
- }
|
|
|
- }
|
|
|
- c.Data["Keyword"] = keyword
|
|
|
+ repos, count, err = models.SearchRepositoryByName(&models.SearchRepoOptions{
|
|
|
+ OrderBy: "id ASC",
|
|
|
+ Private: false,
|
|
|
+ Page: page,
|
|
|
+ })
|
|
|
+
|
|
|
c.Data["Total"] = count
|
|
|
- c.Data["Page"] = paginater.New(int(count), setting.UI.Admin.RepoPagingNum, page, 5)
|
|
|
|
|
|
if err = models.RepositoryList(repos).LoadAttributes(); err != nil {
|
|
|
c.Handle(500, "LoadAttributes", err)
|