Added view of new Kitsu anime
This commit is contained in:
parent
24468ff197
commit
b21329538c
@ -12,6 +12,7 @@ component EditorTabs(url string)
|
||||
.tabs
|
||||
Tab("Editor", "pencil", "/editor")
|
||||
Tab("MAL", "exchange", "/editor/anime/maldiff")
|
||||
Tab("Kitsu", "exchange", "/editor/anime/kitsu/new")
|
||||
Tab("Missing", "list", "/editor/anime/missing/shoboi")
|
||||
Tab("Search", "search", "/database")
|
||||
|
||||
|
30
pages/editor/kitsu.go
Normal file
30
pages/editor/kitsu.go
Normal file
@ -0,0 +1,30 @@
|
||||
package editor
|
||||
|
||||
import (
|
||||
"sort"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/kitsu"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
)
|
||||
|
||||
// NewKitsuAnime ...
|
||||
func NewKitsuAnime(ctx *aero.Context) string {
|
||||
user := utils.GetUser(ctx)
|
||||
|
||||
animes := arn.FilterKitsuAnime(func(anime *kitsu.Anime) bool {
|
||||
_, err := arn.GetAnime(anime.ID)
|
||||
return err != nil
|
||||
})
|
||||
|
||||
sort.Slice(animes, func(i, j int) bool {
|
||||
a := animes[i]
|
||||
b := animes[j]
|
||||
|
||||
return a.ID > b.ID
|
||||
})
|
||||
|
||||
return ctx.HTML(components.NewKitsuAnime(animes, ctx.URI(), user))
|
||||
}
|
28
pages/editor/kitsu.pixy
Normal file
28
pages/editor/kitsu.pixy
Normal file
@ -0,0 +1,28 @@
|
||||
component NewKitsuAnime(animes []*kitsu.Anime, url string, user *arn.User)
|
||||
EditorTabs(url)
|
||||
h1.mountable New anime on Kitsu
|
||||
|
||||
if len(animes) == 0
|
||||
p.text-center.mountable No new anime found.
|
||||
else
|
||||
table
|
||||
thead
|
||||
tr.mountable
|
||||
th ID
|
||||
th Image
|
||||
th Title
|
||||
th Type
|
||||
th Year
|
||||
tbody
|
||||
each anime in animes
|
||||
tr.mountable
|
||||
td= anime.ID
|
||||
td
|
||||
a(href="https://kitsu.io/anime/" + anime.ID, target="_blank")
|
||||
img.profile-watching-list-item-image(src=anime.Attributes.PosterImage.Tiny, alt=anime.Attributes.CanonicalTitle)
|
||||
td
|
||||
a(href="https://kitsu.io/anime/" + anime.ID, target="_blank")= anime.Attributes.CanonicalTitle
|
||||
td= anime.Attributes.ShowType
|
||||
td
|
||||
if len(anime.Attributes.StartDate) >= 4
|
||||
span= anime.Attributes.StartDate[:4]
|
@ -239,6 +239,7 @@ func Configure(app *aero.Application) {
|
||||
l.Page("/editor/anime/maldiff/:year", editor.CompareMAL)
|
||||
l.Page("/editor/anime/maldiff/:year/:status", editor.CompareMAL)
|
||||
l.Page("/editor/anime/maldiff/:year/:status/:type", editor.CompareMAL)
|
||||
l.Page("/editor/anime/kitsu/new", editor.NewKitsuAnime)
|
||||
|
||||
// Log
|
||||
l.Page("/log", editlog.Get)
|
||||
|
Loading…
Reference in New Issue
Block a user