Airing page

This commit is contained in:
Eduard Urbach 2016-11-23 12:44:28 +09:00
parent 5bd00fae0f
commit da96ad60e7
6 changed files with 41 additions and 4 deletions

View File

@ -27,6 +27,7 @@ component Navigation
NavigationButton("Anime", "/anime", "television") NavigationButton("Anime", "/anime", "television")
NavigationButton("Forum", "/forum", "comment") NavigationButton("Forum", "/forum", "comment")
NavigationButton("Genres", "/genres", "tags") NavigationButton("Genres", "/genres", "tags")
NavigationButton("Airing", "/airing", "rss")
component NavigationButton(name string, target string, icon string) component NavigationButton(name string, target string, icon string)
a.navigation-link.navigation-link-left.ajax(href=target) a.navigation-link.navigation-link-left.ajax(href=target)

View File

@ -6,6 +6,7 @@ import (
"github.com/aerogo/aero" "github.com/aerogo/aero"
"github.com/animenotifier/arn" "github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components" "github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/pages/airing"
"github.com/animenotifier/notify.moe/pages/anime" "github.com/animenotifier/notify.moe/pages/anime"
"github.com/animenotifier/notify.moe/pages/dashboard" "github.com/animenotifier/notify.moe/pages/dashboard"
"github.com/animenotifier/notify.moe/pages/forum" "github.com/animenotifier/notify.moe/pages/forum"
@ -55,6 +56,7 @@ func main() {
app.Ajax("/threads/:id", threads.Get) app.Ajax("/threads/:id", threads.Get)
app.Ajax("/posts/:id", posts.Get) app.Ajax("/posts/:id", posts.Get)
app.Ajax("/user/:nick", profile.Get) app.Ajax("/user/:nick", profile.Get)
app.Ajax("/airing", airing.Get)
app.Run() app.Run()
} }

5
mixins/AnimeGrid.pixy Normal file
View File

@ -0,0 +1,5 @@
component AnimeGrid(animeList []*arn.Anime)
.grid
each anime in animeList
a.grid-cell.grid-anime.ajax(href="/anime/" + toString(anime.ID))
img.anime-image.grid-image(src=anime.Image, alt=anime.Title.Romaji, title=anime.Title.Romaji + " (" + toString(anime.Watching) + ")")

29
pages/airing/airing.go Normal file
View File

@ -0,0 +1,29 @@
package airing
import (
"sort"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
)
// Get ...
func Get(ctx *aero.Context) string {
var animeList []*arn.Anime
scan := make(chan *arn.Anime)
arn.Scan("Anime", scan)
for anime := range scan {
if anime.AiringStatus != "currently airing" || anime.Adult {
continue
}
animeList = append(animeList, anime)
}
sort.Sort(arn.AnimeByPopularity(animeList))
return ctx.HTML(components.Airing(animeList))
}

3
pages/airing/airing.pixy Normal file
View File

@ -0,0 +1,3 @@
component Airing(animeList []*arn.Anime)
h2 Airing
AnimeGrid(animeList)

View File

@ -1,6 +1,3 @@
component Genre(genre *arn.Genre) component Genre(genre *arn.Genre)
h2= arn.Capitalize(genre.ID) h2= arn.Capitalize(genre.ID)
.grid AnimeGrid(genre.AnimeList)
each anime in genre.AnimeList
a.grid-cell.grid-anime.ajax(href="/anime/" + toString(anime.ID))
img.anime-image.grid-image(src=anime.Image, alt=anime.Title.Romaji, title=anime.Title.Romaji + " (" + toString(anime.Watching) + ")")