mirror of
https://github.com/go-gitea/gitea.git
synced 2024-11-24 02:59:42 +08:00
minor fixes on #1551
This commit is contained in:
parent
67f07e21f5
commit
7714e792a4
@ -13,6 +13,8 @@ ROOT =
|
||||
SCRIPT_TYPE = bash
|
||||
|
||||
[ui]
|
||||
; Number of repositories that are showed in one explore page
|
||||
EXPLORE_PAGING_NUM = 20
|
||||
; Number of issues that are showed in one page
|
||||
ISSUE_PAGING_NUM = 10
|
||||
|
||||
|
@ -1105,9 +1105,9 @@ func GetRepositories(uid int64, private bool) ([]*Repository, error) {
|
||||
}
|
||||
|
||||
// GetRecentUpdatedRepositories returns the list of repositories that are recently updated.
|
||||
func GetRecentUpdatedRepositories(num int) (repos []*Repository, err error) {
|
||||
err = x.Where("is_private=?", false).Limit(num).Desc("updated").Find(&repos)
|
||||
return repos, err
|
||||
func GetRecentUpdatedRepositories(page int) (repos []*Repository, err error) {
|
||||
return repos, x.Limit(setting.ExplorePagingNum, (page-1)*setting.ExplorePagingNum).
|
||||
Where("is_private=?", false).Limit(setting.ExplorePagingNum).Desc("updated").Find(&repos)
|
||||
}
|
||||
|
||||
// GetRepositoryCount returns the total number of repositories of user.
|
||||
|
File diff suppressed because one or more lines are too long
@ -91,7 +91,8 @@ var (
|
||||
AnsiCharset string
|
||||
|
||||
// UI settings.
|
||||
IssuePagingNum int
|
||||
ExplorePagingNum int
|
||||
IssuePagingNum int
|
||||
|
||||
// Picture settings.
|
||||
PictureService string
|
||||
@ -352,6 +353,7 @@ func NewConfigContext() {
|
||||
AnsiCharset = sec.Key("ANSI_CHARSET").MustString("")
|
||||
|
||||
// UI settings.
|
||||
ExplorePagingNum = Cfg.Section("ui").Key("EXPLORE_PAGING_NUM").MustInt(20)
|
||||
IssuePagingNum = Cfg.Section("ui").Key("ISSUE_PAGING_NUM").MustInt(10)
|
||||
|
||||
sec = Cfg.Section("picture")
|
||||
|
File diff suppressed because it is too large
Load Diff
2
public/css/gogs.min.css
vendored
2
public/css/gogs.min.css
vendored
File diff suppressed because one or more lines are too long
@ -1,3 +1,30 @@
|
||||
.explore {
|
||||
padding-top: 15px;
|
||||
padding-bottom: @footer-margin * 2;
|
||||
|
||||
&.repositories {
|
||||
.ui.repository.list {
|
||||
.item {
|
||||
border-top: 1px solid #eee;
|
||||
padding-top: 25px;
|
||||
padding-bottom: 25px;
|
||||
.ui.header {
|
||||
font-size: 1.5rem;
|
||||
padding-bottom: 10px;
|
||||
.metas {
|
||||
color: #888;
|
||||
font-size: 13px;
|
||||
font-weight: normal;
|
||||
span:not(:last-child) {
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.time {
|
||||
font-size: 12px;
|
||||
color: #808080;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -7,6 +7,8 @@ package routers
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/Unknwon/paginater"
|
||||
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/modules/middleware"
|
||||
@ -50,7 +52,14 @@ func Explore(ctx *middleware.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("explore")
|
||||
ctx.Data["PageIsExploreRepositories"] = true
|
||||
|
||||
repos, err := models.GetRecentUpdatedRepositories(20)
|
||||
page := ctx.QueryInt("page")
|
||||
if page <= 1 {
|
||||
page = 1
|
||||
}
|
||||
|
||||
ctx.Data["Page"] = paginater.New(int(models.CountRepositories()), setting.ExplorePagingNum, page, 5)
|
||||
|
||||
repos, err := models.GetRecentUpdatedRepositories(page)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "GetRecentUpdatedRepositories", err)
|
||||
return
|
||||
|
@ -1,32 +1,47 @@
|
||||
{{template "base/head" .}}
|
||||
<div class="explore">
|
||||
<div class="explore repositories">
|
||||
<div class="ui container">
|
||||
<div class="ui grid">
|
||||
{{template "explore/nav" .}}
|
||||
{{template "explore/navbar" .}}
|
||||
<div class="twelve wide column content">
|
||||
<h4 class="ui top attached header">
|
||||
{{.i18n.Tr "explore.repos"}}
|
||||
</h4>
|
||||
<div class="ui attached segment">
|
||||
<div class="ui repository list">
|
||||
{{range $i, $v := .Repos}}
|
||||
<div class="item">
|
||||
<div class="ui right">
|
||||
<span class="text grey right"><i class="octicon octicon-star"></i> {{.NumStars}}</li> </span>
|
||||
<span class="text grey right"><i class="octicon octicon-git-branch"></i> {{.NumForks}}</li></span>
|
||||
<div class="item">
|
||||
<div class="ui header">
|
||||
<a href="{{AppSubUrl}}/{{.Owner.Name}}/{{.Name}}">{{.Owner.Name}} / {{.Name}}</a>
|
||||
|
||||
<div class="ui right metas">
|
||||
<span class="text grey"><i class="octicon octicon-star"></i> {{.NumStars}}</span>
|
||||
<span class="text grey"><i class="octicon octicon-git-branch"></i> {{.NumForks}}</span>
|
||||
</div>
|
||||
<h2>
|
||||
<a href="{{AppSubUrl}}/{{.Owner.Name}}/{{.Name}}">{{.Owner.Name}} / {{.Name}}</a>
|
||||
</h2>
|
||||
<p class="org-repo-description">{{.Description}}</p>
|
||||
<p class="org-repo-updated">{{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Updated $.i18n.Lang}}</p>
|
||||
</div>
|
||||
{{if not (eq 1 (len $.Repos))}}
|
||||
{{if not $i}}
|
||||
<div class="ui divider"></div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{if .Description}}<p>{{.Description}}</p>{{end}}
|
||||
<p class="time">{{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Updated $.i18n.Lang}}</p>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
{{with .Page}}
|
||||
{{if gt .TotalPages 1}}
|
||||
<div class="center page buttons">
|
||||
<div class="ui borderless pagination menu">
|
||||
<a class="{{if not .HasPrevious}}disabled{{end}} item" {{if .HasPrevious}}href="{{$.Link}}?page={{.Previous}}"{{end}}>
|
||||
<i class="left arrow icon"></i> {{$.i18n.Tr "repo.issues.previous"}}
|
||||
</a>
|
||||
{{range .Pages}}
|
||||
{{if eq .Num -1}}
|
||||
<a class="disabled item">...</a>
|
||||
{{else}}
|
||||
<a class="{{if .IsCurrent}}active{{end}} item" {{if not .IsCurrent}}href="{{$.Link}}?page={{.Num}}"{{end}}>{{.Num}}</a>
|
||||
{{end}}
|
||||
{{end}}
|
||||
<a class="{{if not .HasNext}}disabled{{end}} item" {{if .HasNext}}href="{{$.Link}}?page={{.Next}}"{{end}}>
|
||||
{{$.i18n.Tr "repo.issues.next"}} <i class="icon right arrow"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user