Updated styles

This commit is contained in:
2017-06-08 01:14:45 +02:00
parent fdbfb22ef5
commit 74b405e4b4
14 changed files with 68 additions and 36 deletions

View File

@ -2,6 +2,8 @@ package dashboard
import (
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils"
)
@ -9,24 +11,23 @@ const maxPosts = 5
// Get ...
func Get(ctx *aero.Context) string {
// posts, err := arn.GetPosts()
// if err != nil {
// return ctx.Error(500, "Error fetching posts", err)
// }
// arn.SortPostsLatestFirst(posts)
// if len(posts) > maxPosts {
// posts = posts[:maxPosts]
// }
// return ctx.HTML(components.Dashboard(posts))
user := utils.GetUser(ctx)
if user != nil {
return ctx.HTML("Welcome back, " + user.Nick + "!")
posts, err := arn.GetPosts()
if err != nil {
return ctx.Error(500, "Error fetching posts", err)
}
arn.SortPostsLatestFirst(posts)
if len(posts) > maxPosts {
posts = posts[:maxPosts]
}
return ctx.HTML(components.Dashboard(posts))
}
return ctx.HTML("ARN 4.0 is currently under construction.<br><a href='https://paypal.me/blitzprog' target='_blank' rel='noopener'>Support the development</a><br><a href='/auth/google'>Login via Google</a>")