Added filters to editor lists
This commit is contained in:
parent
0c3ab006e7
commit
af6bc391af
@ -1,10 +1,10 @@
|
||||
component AnimeEditorListFull(title string, missing []*arn.Anime, count int, generateSearchLink func(*arn.Anime) string)
|
||||
component AnimeEditorListFull(title string, missing []*arn.Anime, count int, pageURI string, generateSearchLink func(*arn.Anime) string)
|
||||
EditorTabs
|
||||
h1.editor-list-title.mountable= title
|
||||
.footer.editor-list-entry-count.mountable= strconv.Itoa(count) + " anime"
|
||||
AnimeEditorList(missing, generateSearchLink)
|
||||
AnimeEditorList(missing, pageURI, generateSearchLink)
|
||||
|
||||
component AnimeEditorList(animes []*arn.Anime, generateSearchLink func(*arn.Anime) string)
|
||||
component AnimeEditorList(animes []*arn.Anime, pageURI string, generateSearchLink func(*arn.Anime) string)
|
||||
table
|
||||
thead
|
||||
tr.mountable
|
||||
@ -24,7 +24,7 @@ component AnimeEditorList(animes []*arn.Anime, generateSearchLink func(*arn.Anim
|
||||
td= anime.Type
|
||||
td
|
||||
if len(anime.StartDate) >= 4
|
||||
span= anime.StartDate[:4]
|
||||
a.ajax(href=pageURI + "/" + anime.StartDate[:4])= anime.StartDate[:4]
|
||||
|
||||
if generateSearchLink != nil
|
||||
td
|
||||
|
@ -12,7 +12,18 @@ const maxAniListEntries = 70
|
||||
|
||||
// AniList ...
|
||||
func AniList(ctx *aero.Context) string {
|
||||
year, _ := ctx.GetInt("year")
|
||||
animeType := ctx.Get("type")
|
||||
|
||||
missing := arn.FilterAnime(func(anime *arn.Anime) bool {
|
||||
if year != 0 && year != anime.StartDateTime().Year() {
|
||||
return false
|
||||
}
|
||||
|
||||
if animeType != "" && anime.Type != animeType {
|
||||
return false
|
||||
}
|
||||
|
||||
return anime.GetMapping("anilist/anime") == ""
|
||||
})
|
||||
|
||||
@ -40,6 +51,7 @@ func AniList(ctx *aero.Context) string {
|
||||
"Anime without Anilist links",
|
||||
missing,
|
||||
count,
|
||||
"/editor/anilist",
|
||||
func(anime *arn.Anime) string {
|
||||
return "https://anilist.co/search?type=anime&q=" + anime.Title.Canonical
|
||||
},
|
||||
|
@ -12,7 +12,18 @@ const maxGenreEntries = 70
|
||||
|
||||
// Genres ...
|
||||
func Genres(ctx *aero.Context) string {
|
||||
year, _ := ctx.GetInt("year")
|
||||
animeType := ctx.Get("type")
|
||||
|
||||
missing := arn.FilterAnime(func(anime *arn.Anime) bool {
|
||||
if year != 0 && year != anime.StartDateTime().Year() {
|
||||
return false
|
||||
}
|
||||
|
||||
if animeType != "" && anime.Type != animeType {
|
||||
return false
|
||||
}
|
||||
|
||||
return len(anime.Genres) == 0
|
||||
})
|
||||
|
||||
@ -40,6 +51,7 @@ func Genres(ctx *aero.Context) string {
|
||||
"Anime without genres",
|
||||
missing,
|
||||
count,
|
||||
"/editor/genres",
|
||||
nil,
|
||||
))
|
||||
}
|
||||
|
@ -12,7 +12,18 @@ const maxShoboiEntries = 70
|
||||
|
||||
// Shoboi ...
|
||||
func Shoboi(ctx *aero.Context) string {
|
||||
year, _ := ctx.GetInt("year")
|
||||
animeType := ctx.Get("type")
|
||||
|
||||
missing := arn.FilterAnime(func(anime *arn.Anime) bool {
|
||||
if year != 0 && year != anime.StartDateTime().Year() {
|
||||
return false
|
||||
}
|
||||
|
||||
if animeType != "" && anime.Type != animeType {
|
||||
return false
|
||||
}
|
||||
|
||||
return anime.GetMapping("shoboi/anime") == ""
|
||||
})
|
||||
|
||||
@ -40,6 +51,7 @@ func Shoboi(ctx *aero.Context) string {
|
||||
"Anime without Shoboi links",
|
||||
missing,
|
||||
count,
|
||||
"/editor/shoboi",
|
||||
func(anime *arn.Anime) string {
|
||||
return "http://cal.syoboi.jp/find?type=quick&sd=1&kw=" + anime.Title.Japanese
|
||||
},
|
||||
|
@ -200,8 +200,14 @@ func Configure(app *aero.Application) {
|
||||
// Editor
|
||||
l.Page("/editor", editor.Get)
|
||||
l.Page("/editor/anilist", editor.AniList)
|
||||
l.Page("/editor/anilist/:year", editor.AniList)
|
||||
l.Page("/editor/anilist/:year/:type", editor.AniList)
|
||||
l.Page("/editor/shoboi", editor.Shoboi)
|
||||
l.Page("/editor/shoboi/:year", editor.Shoboi)
|
||||
l.Page("/editor/shoboi/:year/:type", editor.Shoboi)
|
||||
l.Page("/editor/genres", editor.Genres)
|
||||
l.Page("/editor/genres/:year", editor.Genres)
|
||||
l.Page("/editor/genres/:year/:type", editor.Genres)
|
||||
|
||||
// Mixed
|
||||
l.Page("/database", database.Get)
|
||||
|
Loading…
Reference in New Issue
Block a user