Implemented groups

This commit is contained in:
2017-10-17 23:17:04 +02:00
parent e9b6cb3ac8
commit 63a421e6a2
15 changed files with 248 additions and 158 deletions

25
pages/groups/groups.go Normal file
View File

@ -0,0 +1,25 @@
package groups
import (
"net/http"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils"
)
// Get ...
func Get(ctx *aero.Context) string {
user := utils.GetUser(ctx)
groups, err := arn.FilterGroups(func(group *arn.Group) bool {
return !group.IsDraft
})
if err != nil {
return ctx.Error(http.StatusInternalServerError, "Error fetching groups", err)
}
return ctx.HTML(components.Groups(groups, user))
}