Added view for companies without description

This commit is contained in:
Eduard Urbach 2018-03-19 22:28:44 +01:00
parent 3d810f3b1f
commit a5fbd84b09
4 changed files with 51 additions and 1 deletions

View File

@ -13,7 +13,8 @@ component EditorTabs(url string)
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("Anime", "tv", "/editor/anime/missing/shoboi")
Tab("Companies", "building", "/editor/companies/missing/description")
Tab("Search", "search", "/database")
if strings.Contains(url, "/editor/anime/missing/")

View File

@ -0,0 +1,26 @@
package filtercompanies
import (
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
)
const maxEntries = 70
// NoDescription ...
func NoDescription(ctx *aero.Context) string {
companies := arn.FilterCompanies(func(company *arn.Company) bool {
return !company.IsDraft && len(company.Description) < 5
})
arn.SortCompaniesPopularFirst(companies)
count := len(companies)
if count > maxEntries {
companies = companies[:maxEntries]
}
return ctx.HTML(components.CompaniesEditorList(companies, count, ctx.URI()))
}

View File

@ -0,0 +1,17 @@
component CompaniesEditorList(companies []*arn.Company, count int, url string)
EditorTabs(url)
h1.editor-list-title.mountable Companies without a description
.footer.editor-list-entry-count.mountable= strconv.Itoa(count) + " companies"
table
thead
tr.mountable
th Name
th Search
tbody
each company in companies
tr.mountable
td
a(href=company.Link(), target="_blank", rel="noopener")= company.Name.English
td
a(href="https://en.wikipedia.org/w/index.php?search=" + company.Name.English, target="_blank", rel="noopener") 🔍

View File

@ -22,6 +22,7 @@ import (
"github.com/animenotifier/notify.moe/pages/editanime"
"github.com/animenotifier/notify.moe/pages/editlog"
"github.com/animenotifier/notify.moe/pages/editor"
"github.com/animenotifier/notify.moe/pages/editor/filtercompanies"
"github.com/animenotifier/notify.moe/pages/embed"
"github.com/animenotifier/notify.moe/pages/episode"
"github.com/animenotifier/notify.moe/pages/explore"
@ -242,6 +243,8 @@ func Configure(app *aero.Application) {
// Editor
l.Page("/editor", editor.Get)
// Editor - Anime
l.Page("/editor/anime/missing/anilist", editor.AniList)
l.Page("/editor/anime/missing/anilist/:year", editor.AniList)
l.Page("/editor/anime/missing/anilist/:year/:type", editor.AniList)
@ -257,6 +260,9 @@ func Configure(app *aero.Application) {
l.Page("/editor/anime/maldiff/:year/:status/:type", editor.CompareMAL)
l.Page("/editor/anime/kitsu/new", editor.NewKitsuAnime)
// Editor - Companies
l.Page("/editor/companies/missing/description", filtercompanies.NoDescription)
// Log
l.Page("/log", editlog.Get)