Improved anime lists

This commit is contained in:
Eduard Urbach 2017-06-29 23:27:21 +02:00
parent 72087df11c
commit f648f19686
4 changed files with 41 additions and 4 deletions

View File

@ -27,5 +27,5 @@ func Get(ctx *aero.Context) string {
animeList.Sort()
return ctx.HTML(components.AnimeList(animeList, user))
return ctx.HTML(components.AnimeLists(animeList.SplitByStatus(), animeList.User(), user))
}

View File

@ -1,5 +1,36 @@
component AnimeLists(animeLists map[string]*arn.AnimeList, viewUser *arn.User, user *arn.User)
h2.anime-list-owner= viewUser.Nick + "'s collection"
if len(animeLists[arn.AnimeListStatusWatching].Items) > 0
.anime-list-container
h3.status-name Watching
AnimeList(animeLists[arn.AnimeListStatusWatching], user)
if len(animeLists[arn.AnimeListStatusCompleted].Items) > 0
.anime-list-container
h3.status-name Completed
AnimeList(animeLists[arn.AnimeListStatusCompleted], user)
if len(animeLists[arn.AnimeListStatusPlanned].Items) > 0
.anime-list-container
h3.status-name Planned
AnimeList(animeLists[arn.AnimeListStatusPlanned], user)
if len(animeLists[arn.AnimeListStatusHold].Items) > 0
.anime-list-container
h3.status-name On hold
AnimeList(animeLists[arn.AnimeListStatusHold], user)
if len(animeLists[arn.AnimeListStatusDropped].Items) > 0
.anime-list-container
h3.status-name Dropped
AnimeList(animeLists[arn.AnimeListStatusDropped], user)
//- for status, animeList := range animeLists
//- h3= status
//- AnimeList(animeList, user)
component AnimeList(animeList *arn.AnimeList, user *arn.User)
h2.anime-list-owner= animeList.User().Nick + "'s collection"
table.anime-list
thead
tr

View File

@ -1,8 +1,12 @@
.anime-list
.anime-list-container
vertical
width 100%
max-width 1200px
margin 0 auto
margin-bottom 1rem
.anime-list
vertical
tr
horizontal

View File

@ -4,6 +4,7 @@ import (
"net/http"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils"
)
@ -23,6 +24,7 @@ func Get(ctx *aero.Context) string {
}
animeList.Sort()
watchingList := animeList.SplitByStatus()[arn.AnimeListStatusWatching]
return utils.AllowEmbed(ctx, ctx.HTML(components.AnimeList(animeList, user)))
return utils.AllowEmbed(ctx, ctx.HTML(components.AnimeList(watchingList, user)))
}