New dashboard idea (still not happy though)

This commit is contained in:
2016-11-22 12:34:59 +09:00
parent 4159525c25
commit 80506aa92e
18 changed files with 192 additions and 79 deletions

View File

@ -1,11 +1,28 @@
package dashboard
import (
"sort"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
)
const maxPosts = 6
// Get ...
func Get(ctx *aero.Context) string {
return ctx.HTML(components.Dashboard())
posts, err := arn.GetPosts()
if err != nil {
return ctx.Error(500, "Error fetching posts")
}
sort.Sort(sort.Reverse(posts))
if len(posts) > maxPosts {
posts = posts[:maxPosts]
}
return ctx.HTML(components.Dashboard(posts))
}

View File

@ -1,4 +1,12 @@
component Dashboard
component Dashboard(posts []*arn.Post)
section
header
h2 Dash
h2 Dash
.dashboard-widget
each post in posts
a.dashboard-event.ui.ajax(href=post.Link())
.dashboard-event-author
AvatarNoLink(post.Author())
.dashboard-event-text
span= post.Thread().Title

View File

@ -0,0 +1,23 @@
.dashboard-widget
display flex
flex-flow column
align-items center
.dashboard-event
display flex
flex-flow column wrap
margin-bottom 1rem
padding 0.75rem
width 100%
max-width 700px
.dashboard-event-author
display flex
justify-content center
width 100%
.dashboard-event-text
display flex
justify-content center
align-items center
width 100%