Display anime without genres for editors
This commit is contained in:
parent
42fcaea4ea
commit
ac5fef5737
21
mixins/AnimeEditorList.pixy
Normal file
21
mixins/AnimeEditorList.pixy
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
component AnimeEditorList(animes []*arn.Anime, generateSearchLink func(*arn.Anime) string)
|
||||||
|
table
|
||||||
|
thead
|
||||||
|
tr.mountable
|
||||||
|
th(title="Popularity") Pop.
|
||||||
|
th Title
|
||||||
|
th Type
|
||||||
|
th Year
|
||||||
|
th Tools
|
||||||
|
tbody
|
||||||
|
each anime in animes
|
||||||
|
tr.mountable
|
||||||
|
td= anime.Popularity.Total()
|
||||||
|
td
|
||||||
|
a(href=anime.Link(), target="_blank", rel="noopener")= anime.Title.Canonical
|
||||||
|
td= anime.Type
|
||||||
|
td
|
||||||
|
if len(anime.StartDate) >= 4
|
||||||
|
span= anime.StartDate[:4]
|
||||||
|
td
|
||||||
|
a(href=generateSearchLink(anime), target="_blank", rel="noopener") Search
|
@ -34,5 +34,7 @@ func AniList(ctx *aero.Context) string {
|
|||||||
missing = missing[:maxAniListEntries]
|
missing = missing[:maxAniListEntries]
|
||||||
}
|
}
|
||||||
|
|
||||||
return ctx.HTML(components.AniListMissingMapping(missing))
|
return ctx.HTML(components.AniListMissingMapping(missing, func(anime *arn.Anime) string {
|
||||||
|
return "https://anilist.co/search?type=anime&q=" + anime.Title.Canonical
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,4 @@
|
|||||||
component AniListMissingMapping(missing []*arn.Anime)
|
component AniListMissingMapping(missing []*arn.Anime, generateSearchLink func(*arn.Anime) string)
|
||||||
h1.page-title Anime without Anilist links
|
|
||||||
|
|
||||||
EditorTabs
|
EditorTabs
|
||||||
|
h1.mountable Anime without Anilist links
|
||||||
table
|
AnimeEditorList(missing, generateSearchLink)
|
||||||
thead
|
|
||||||
tr
|
|
||||||
th(title="Popularity") Pop.
|
|
||||||
th Title
|
|
||||||
th Type
|
|
||||||
th Year
|
|
||||||
th Tools
|
|
||||||
tbody
|
|
||||||
each anime in missing
|
|
||||||
tr.mountable
|
|
||||||
td= anime.Popularity.Total()
|
|
||||||
td
|
|
||||||
a(href=anime.Link(), target="_blank", rel="noopener")= anime.Title.Canonical
|
|
||||||
td= anime.Type
|
|
||||||
td
|
|
||||||
if len(anime.StartDate) >= 4
|
|
||||||
span= anime.StartDate[:4]
|
|
||||||
td
|
|
||||||
a(href="https://anilist.co/search?type=anime&q=" + anime.Title.Canonical, target="_blank", rel="noopener") Search
|
|
@ -8,10 +8,10 @@ component Editor
|
|||||||
component EditorTabs
|
component EditorTabs
|
||||||
.tabs
|
.tabs
|
||||||
Tab("Editor", "pencil", "/editor")
|
Tab("Editor", "pencil", "/editor")
|
||||||
Tab("Search", "search", "/database")
|
|
||||||
Tab("Shoboi", "list", "/editor/shoboi")
|
Tab("Shoboi", "list", "/editor/shoboi")
|
||||||
Tab("AniList", "list", "/editor/anilist")
|
Tab("AniList", "list", "/editor/anilist")
|
||||||
Tab("Genres", "list", "/editor/genres")
|
Tab("Genres", "list", "/editor/genres")
|
||||||
|
Tab("Search", "search", "/database")
|
||||||
|
|
||||||
//- a.tab.ajax(href="/admin", aria-label="Admin")
|
//- a.tab.ajax(href="/admin", aria-label="Admin")
|
||||||
//- Icon("wrench")
|
//- Icon("wrench")
|
||||||
|
40
pages/editor/genres.go
Normal file
40
pages/editor/genres.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package editor
|
||||||
|
|
||||||
|
import (
|
||||||
|
"sort"
|
||||||
|
|
||||||
|
"github.com/aerogo/aero"
|
||||||
|
"github.com/animenotifier/arn"
|
||||||
|
"github.com/animenotifier/notify.moe/components"
|
||||||
|
)
|
||||||
|
|
||||||
|
const maxGenreEntries = 70
|
||||||
|
|
||||||
|
// Genres ...
|
||||||
|
func Genres(ctx *aero.Context) string {
|
||||||
|
missing := arn.FilterAnime(func(anime *arn.Anime) bool {
|
||||||
|
return len(anime.Genres) == 0
|
||||||
|
})
|
||||||
|
|
||||||
|
sort.Slice(missing, func(i, j int) bool {
|
||||||
|
a := missing[i]
|
||||||
|
b := missing[j]
|
||||||
|
|
||||||
|
aPop := a.Popularity.Total()
|
||||||
|
bPop := b.Popularity.Total()
|
||||||
|
|
||||||
|
if aPop == bPop {
|
||||||
|
return a.Title.Canonical < b.Title.Canonical
|
||||||
|
}
|
||||||
|
|
||||||
|
return aPop > bPop
|
||||||
|
})
|
||||||
|
|
||||||
|
if len(missing) > maxGenreEntries {
|
||||||
|
missing = missing[:maxGenreEntries]
|
||||||
|
}
|
||||||
|
|
||||||
|
return ctx.HTML(components.AnimeWithoutGenres(missing, func(anime *arn.Anime) string {
|
||||||
|
return "https://anilist.co/search?type=anime&q=" + anime.Title.Canonical
|
||||||
|
}))
|
||||||
|
}
|
4
pages/editor/genres.pixy
Normal file
4
pages/editor/genres.pixy
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
component AnimeWithoutGenres(missing []*arn.Anime, generateSearchLink func(*arn.Anime) string)
|
||||||
|
EditorTabs
|
||||||
|
h1.mountable Anime without genres
|
||||||
|
AnimeEditorList(missing, generateSearchLink)
|
@ -34,5 +34,7 @@ func Shoboi(ctx *aero.Context) string {
|
|||||||
missing = missing[:maxShoboiEntries]
|
missing = missing[:maxShoboiEntries]
|
||||||
}
|
}
|
||||||
|
|
||||||
return ctx.HTML(components.ShoboiMissingMapping(missing))
|
return ctx.HTML(components.ShoboiMissingMapping(missing, func(anime *arn.Anime) string {
|
||||||
|
return "http://cal.syoboi.jp/find?type=quick&sd=1&kw=" + anime.Title.Japanese
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,4 @@
|
|||||||
component ShoboiMissingMapping(missing []*arn.Anime)
|
component ShoboiMissingMapping(missing []*arn.Anime, generateSearchLink func(*arn.Anime) string)
|
||||||
h1.page-title Anime without Shoboi links
|
|
||||||
|
|
||||||
EditorTabs
|
EditorTabs
|
||||||
|
h1.mountable Anime without Shoboi links
|
||||||
table
|
AnimeEditorList(missing, generateSearchLink)
|
||||||
thead
|
|
||||||
tr
|
|
||||||
th(title="Popularity") Pop.
|
|
||||||
th Title
|
|
||||||
th Type
|
|
||||||
th Year
|
|
||||||
th Tools
|
|
||||||
tbody
|
|
||||||
each anime in missing
|
|
||||||
tr.mountable
|
|
||||||
td= anime.Popularity.Total()
|
|
||||||
td
|
|
||||||
a(href=anime.Link(), target="_blank", rel="noopener")= anime.Title.Canonical
|
|
||||||
td= anime.Type
|
|
||||||
td
|
|
||||||
if len(anime.StartDate) >= 4
|
|
||||||
span= anime.StartDate[:4]
|
|
||||||
td
|
|
||||||
a(href="http://cal.syoboi.jp/find?type=quick&sd=1&kw=" + anime.Title.Japanese, target="_blank", rel="noopener") Search
|
|
||||||
|
@ -200,6 +200,7 @@ func Configure(app *aero.Application) {
|
|||||||
l.Page("/editor", editor.Get)
|
l.Page("/editor", editor.Get)
|
||||||
l.Page("/editor/anilist", editor.AniList)
|
l.Page("/editor/anilist", editor.AniList)
|
||||||
l.Page("/editor/shoboi", editor.Shoboi)
|
l.Page("/editor/shoboi", editor.Shoboi)
|
||||||
|
l.Page("/editor/genres", editor.Genres)
|
||||||
|
|
||||||
// Mixed
|
// Mixed
|
||||||
l.Page("/database", database.Get)
|
l.Page("/database", database.Get)
|
||||||
|
Loading…
Reference in New Issue
Block a user