Added repository search ordered by stars or forks. Forks column in admin repo list. (#3969)
* Added repository search order by stars or forks. Added Forks column to admin repository list. Signed-off-by: Alexey Terentyev <axifnx@gmail.com> * Renamed search repo template Signed-off-by: Alexey Terentyev <axifnx@gmail.com>
This commit is contained in:
parent
ea2a938e8a
commit
b908ac9fab
11 changed files with 99 additions and 16 deletions
|
@ -152,6 +152,10 @@ const (
|
|||
SearchOrderBySizeReverse = "size DESC"
|
||||
SearchOrderByID = "id ASC"
|
||||
SearchOrderByIDReverse = "id DESC"
|
||||
SearchOrderByStars = "num_stars ASC"
|
||||
SearchOrderByStarsReverse = "num_stars DESC"
|
||||
SearchOrderByForks = "num_forks ASC"
|
||||
SearchOrderByForksReverse = "num_forks DESC"
|
||||
)
|
||||
|
||||
// SearchRepositoryByName takes keyword and part of repository name to search,
|
||||
|
|
|
@ -1272,7 +1272,7 @@ func GetUser(user *User) (bool, error) {
|
|||
type SearchUserOptions struct {
|
||||
Keyword string
|
||||
Type UserType
|
||||
OrderBy string
|
||||
OrderBy SearchOrderBy
|
||||
Page int
|
||||
PageSize int // Can be smaller than or equal to setting.UI.ExplorePagingNum
|
||||
IsActive util.OptionalBool
|
||||
|
@ -1322,7 +1322,7 @@ func SearchUsers(opts *SearchUserOptions) (users []*User, _ int64, _ error) {
|
|||
users = make([]*User, 0, opts.PageSize)
|
||||
return users, count, x.Where(cond).
|
||||
Limit(opts.PageSize, (opts.Page-1)*opts.PageSize).
|
||||
OrderBy(opts.OrderBy).
|
||||
OrderBy(opts.OrderBy.String()).
|
||||
Find(&users)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue