From 0c3ab006e7ee09a366ce98a8a0e08e395a56b7f6 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Wed, 7 Mar 2018 21:25:24 +0100 Subject: [PATCH] Added record count info to editor lists --- mixins/AnimeEditorList.pixy | 6 ++++++ pages/editor/anilist.go | 15 +++++++++++---- pages/editor/anilist.pixy | 4 ---- pages/editor/editor.scarlet | 5 +++++ pages/editor/genres.go | 11 +++++++++-- pages/editor/genres.pixy | 4 ---- pages/editor/shoboi.go | 15 +++++++++++---- pages/editor/shoboi.pixy | 4 ---- 8 files changed, 42 insertions(+), 22 deletions(-) delete mode 100644 pages/editor/anilist.pixy create mode 100644 pages/editor/editor.scarlet delete mode 100644 pages/editor/genres.pixy delete mode 100644 pages/editor/shoboi.pixy diff --git a/mixins/AnimeEditorList.pixy b/mixins/AnimeEditorList.pixy index 0341ca99..55a9a90d 100644 --- a/mixins/AnimeEditorList.pixy +++ b/mixins/AnimeEditorList.pixy @@ -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) table thead diff --git a/pages/editor/anilist.go b/pages/editor/anilist.go index e2c19d90..5d9b7205 100644 --- a/pages/editor/anilist.go +++ b/pages/editor/anilist.go @@ -30,11 +30,18 @@ func AniList(ctx *aero.Context) string { return aPop > bPop }) - if len(missing) > maxAniListEntries { + count := len(missing) + + if count > maxAniListEntries { missing = missing[:maxAniListEntries] } - return ctx.HTML(components.AniListMissingMapping(missing, func(anime *arn.Anime) string { - return "https://anilist.co/search?type=anime&q=" + anime.Title.Canonical - })) + return ctx.HTML(components.AnimeEditorListFull( + "Anime without Anilist links", + missing, + count, + func(anime *arn.Anime) string { + return "https://anilist.co/search?type=anime&q=" + anime.Title.Canonical + }, + )) } diff --git a/pages/editor/anilist.pixy b/pages/editor/anilist.pixy deleted file mode 100644 index 482fb639..00000000 --- a/pages/editor/anilist.pixy +++ /dev/null @@ -1,4 +0,0 @@ -component AniListMissingMapping(missing []*arn.Anime, generateSearchLink func(*arn.Anime) string) - EditorTabs - h1.mountable Anime without Anilist links - AnimeEditorList(missing, generateSearchLink) \ No newline at end of file diff --git a/pages/editor/editor.scarlet b/pages/editor/editor.scarlet new file mode 100644 index 00000000..acabb1ba --- /dev/null +++ b/pages/editor/editor.scarlet @@ -0,0 +1,5 @@ +.editor-list-title + margin-bottom 0 + +.editor-list-entry-count + margin-top 0 \ No newline at end of file diff --git a/pages/editor/genres.go b/pages/editor/genres.go index 8eec0048..680f2c83 100644 --- a/pages/editor/genres.go +++ b/pages/editor/genres.go @@ -30,9 +30,16 @@ func Genres(ctx *aero.Context) string { return aPop > bPop }) - if len(missing) > maxGenreEntries { + count := len(missing) + + if count > maxGenreEntries { missing = missing[:maxGenreEntries] } - return ctx.HTML(components.AnimeWithoutGenres(missing, nil)) + return ctx.HTML(components.AnimeEditorListFull( + "Anime without genres", + missing, + count, + nil, + )) } diff --git a/pages/editor/genres.pixy b/pages/editor/genres.pixy deleted file mode 100644 index a799c270..00000000 --- a/pages/editor/genres.pixy +++ /dev/null @@ -1,4 +0,0 @@ -component AnimeWithoutGenres(missing []*arn.Anime, generateSearchLink func(*arn.Anime) string) - EditorTabs - h1.mountable Anime without genres - AnimeEditorList(missing, generateSearchLink) \ No newline at end of file diff --git a/pages/editor/shoboi.go b/pages/editor/shoboi.go index 01b5bbcc..43abd2c1 100644 --- a/pages/editor/shoboi.go +++ b/pages/editor/shoboi.go @@ -30,11 +30,18 @@ func Shoboi(ctx *aero.Context) string { return aPop > bPop }) - if len(missing) > maxShoboiEntries { + count := len(missing) + + if count > maxShoboiEntries { missing = missing[:maxShoboiEntries] } - 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 - })) + return ctx.HTML(components.AnimeEditorListFull( + "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 + }, + )) } diff --git a/pages/editor/shoboi.pixy b/pages/editor/shoboi.pixy deleted file mode 100644 index 16481268..00000000 --- a/pages/editor/shoboi.pixy +++ /dev/null @@ -1,4 +0,0 @@ -component ShoboiMissingMapping(missing []*arn.Anime, generateSearchLink func(*arn.Anime) string) - EditorTabs - h1.mountable Anime without Shoboi links - AnimeEditorList(missing, generateSearchLink)