Implemented group image upload
This commit is contained in:
22
pages/groups/popular.go
Normal file
22
pages/groups/popular.go
Normal file
@ -0,0 +1,22 @@
|
||||
package groups
|
||||
|
||||
import (
|
||||
"sort"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
)
|
||||
|
||||
// Popular shows the most popular groups.
|
||||
func Popular(ctx *aero.Context) string {
|
||||
groups := fetchGroups()
|
||||
|
||||
sort.Slice(groups, func(i, j int) bool {
|
||||
if len(groups[i].Members) == len(groups[j].Members) {
|
||||
return groups[i].Created > groups[j].Created
|
||||
}
|
||||
|
||||
return len(groups[i].Members) > len(groups[j].Members)
|
||||
})
|
||||
|
||||
return render(ctx, groups)
|
||||
}
|
Reference in New Issue
Block a user