Added record count info to editor lists

This commit is contained in:
Eduard Urbach 2018-03-07 21:25:24 +01:00
parent 1690f0087c
commit 0c3ab006e7
8 changed files with 42 additions and 22 deletions

View File

@ -1,3 +1,9 @@
component AnimeEditorListFull(title string, missing []*arn.Anime, count int, 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)
component AnimeEditorList(animes []*arn.Anime, generateSearchLink func(*arn.Anime) string) component AnimeEditorList(animes []*arn.Anime, generateSearchLink func(*arn.Anime) string)
table table
thead thead

View File

@ -30,11 +30,18 @@ func AniList(ctx *aero.Context) string {
return aPop > bPop return aPop > bPop
}) })
if len(missing) > maxAniListEntries { count := len(missing)
if count > maxAniListEntries {
missing = missing[:maxAniListEntries] missing = missing[:maxAniListEntries]
} }
return ctx.HTML(components.AniListMissingMapping(missing, func(anime *arn.Anime) string { return ctx.HTML(components.AnimeEditorListFull(
return "https://anilist.co/search?type=anime&q=" + anime.Title.Canonical "Anime without Anilist links",
})) missing,
count,
func(anime *arn.Anime) string {
return "https://anilist.co/search?type=anime&q=" + anime.Title.Canonical
},
))
} }

View File

@ -1,4 +0,0 @@
component AniListMissingMapping(missing []*arn.Anime, generateSearchLink func(*arn.Anime) string)
EditorTabs
h1.mountable Anime without Anilist links
AnimeEditorList(missing, generateSearchLink)

View File

@ -0,0 +1,5 @@
.editor-list-title
margin-bottom 0
.editor-list-entry-count
margin-top 0

View File

@ -30,9 +30,16 @@ func Genres(ctx *aero.Context) string {
return aPop > bPop return aPop > bPop
}) })
if len(missing) > maxGenreEntries { count := len(missing)
if count > maxGenreEntries {
missing = missing[:maxGenreEntries] missing = missing[:maxGenreEntries]
} }
return ctx.HTML(components.AnimeWithoutGenres(missing, nil)) return ctx.HTML(components.AnimeEditorListFull(
"Anime without genres",
missing,
count,
nil,
))
} }

View File

@ -1,4 +0,0 @@
component AnimeWithoutGenres(missing []*arn.Anime, generateSearchLink func(*arn.Anime) string)
EditorTabs
h1.mountable Anime without genres
AnimeEditorList(missing, generateSearchLink)

View File

@ -30,11 +30,18 @@ func Shoboi(ctx *aero.Context) string {
return aPop > bPop return aPop > bPop
}) })
if len(missing) > maxShoboiEntries { count := len(missing)
if count > maxShoboiEntries {
missing = missing[:maxShoboiEntries] missing = missing[:maxShoboiEntries]
} }
return ctx.HTML(components.ShoboiMissingMapping(missing, func(anime *arn.Anime) string { return ctx.HTML(components.AnimeEditorListFull(
return "http://cal.syoboi.jp/find?type=quick&sd=1&kw=" + anime.Title.Japanese "Anime without Shoboi links",
})) missing,
count,
func(anime *arn.Anime) string {
return "http://cal.syoboi.jp/find?type=quick&sd=1&kw=" + anime.Title.Japanese
},
))
} }

View File

@ -1,4 +0,0 @@
component ShoboiMissingMapping(missing []*arn.Anime, generateSearchLink func(*arn.Anime) string)
EditorTabs
h1.mountable Anime without Shoboi links
AnimeEditorList(missing, generateSearchLink)