Genre flipcards
This commit is contained in:
parent
fbcef9008d
commit
76fee33c7d
@ -41,7 +41,7 @@ component Anime(anime *arn.Anime)
|
|||||||
.light-button-group
|
.light-button-group
|
||||||
each genre in anime.Genres
|
each genre in anime.Genres
|
||||||
if genre != ""
|
if genre != ""
|
||||||
a.light-button.ajax(href="/genres/" + arn.FixGenre(genre))
|
a.light-button.ajax(href="/genres/" + arn.GetGenreIDByName(genre))
|
||||||
Icon(arn.GetGenreIcon(genre))
|
Icon(arn.GetGenreIcon(genre))
|
||||||
span= genre
|
span= genre
|
||||||
|
|
||||||
|
@ -9,13 +9,11 @@ import (
|
|||||||
// Get ...
|
// Get ...
|
||||||
func Get(ctx *aero.Context) string {
|
func Get(ctx *aero.Context) string {
|
||||||
genreName := ctx.Get("name")
|
genreName := ctx.Get("name")
|
||||||
genreInfo := new(arn.Genre)
|
genre, err := arn.GetGenre(genreName)
|
||||||
|
|
||||||
err := arn.GetObject("Genres", genreName, genreInfo)
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err.Error()
|
return err.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
return ctx.HTML(components.Genre(genreInfo.Genre, genreInfo.AnimeList))
|
return ctx.HTML(components.Genre(genre.Name, genre.AnimeList))
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,27 @@
|
|||||||
package genres
|
package genres
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/aerogo/aero"
|
"github.com/aerogo/aero"
|
||||||
|
"github.com/animenotifier/arn"
|
||||||
"github.com/animenotifier/notify.moe/components"
|
"github.com/animenotifier/notify.moe/components"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Get ...
|
// Get ...
|
||||||
func Get(ctx *aero.Context) string {
|
func Get(ctx *aero.Context) string {
|
||||||
return ctx.HTML(components.Genres())
|
var genres []*arn.Genre
|
||||||
|
|
||||||
|
for _, genreName := range arn.Genres {
|
||||||
|
genre, err := arn.GetGenre(arn.GetGenreIDByName(genreName))
|
||||||
|
|
||||||
|
if err == nil {
|
||||||
|
genre.Name = genreName
|
||||||
|
genres = append(genres, genre)
|
||||||
|
} else {
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ctx.HTML(components.Genres(genres))
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
component Genres
|
component Genres(genres []*arn.Genre)
|
||||||
h2 Genres
|
h2 Genres
|
||||||
|
|
||||||
.grid
|
.grid
|
||||||
each genre in arn.Genres
|
each genre in genres
|
||||||
a.grid-cell.backside-card.ajax(href="/genres/" + arn.FixGenre(genre))
|
a.grid-cell.backside-card.ajax(href="/genres/" + genre.ID)
|
||||||
.grid-text.front
|
.grid-text.front
|
||||||
GridIcon(arn.GetGenreIcon(genre))
|
GridIcon(arn.GetGenreIcon(genre.Name))
|
||||||
span= genre
|
span= genre.Name
|
||||||
img.grid-image.back(src="https://cdn.anilist.co/img/dir/anime/reg/21519-4I676N0vzuek.jpg", alt="")
|
|
||||||
|
if len(genre.AnimeList) > 0
|
||||||
|
img.grid-image.back(src=genre.AnimeList[0].Image, alt=genre.AnimeList[0].Title.Romaji)
|
Loading…
Reference in New Issue
Block a user