Added Shoboi to admin view
This commit is contained in:
parent
ba445f6d74
commit
1806a623bc
1
main.go
1
main.go
@ -126,6 +126,7 @@ func configure(app *aero.Application) *aero.Application {
|
|||||||
// Admin
|
// Admin
|
||||||
app.Ajax("/admin", admin.Get)
|
app.Ajax("/admin", admin.Get)
|
||||||
app.Ajax("/admin/anilist", admin.AniList)
|
app.Ajax("/admin/anilist", admin.AniList)
|
||||||
|
app.Ajax("/admin/shoboi", admin.Shoboi)
|
||||||
app.Ajax("/admin/webdev", admin.WebDev)
|
app.Ajax("/admin/webdev", admin.WebDev)
|
||||||
|
|
||||||
// Import
|
// Import
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
component AdminTabs
|
component AdminTabs
|
||||||
.tabs
|
.tabs
|
||||||
Tab("Server", "server", "/admin")
|
Tab("Server", "server", "/admin")
|
||||||
|
Tab("Shoboi", "calendar", "/admin/shoboi")
|
||||||
Tab("AniList", "list", "/admin/anilist")
|
Tab("AniList", "list", "/admin/anilist")
|
||||||
Tab("WebDev", "html5", "/admin/webdev")
|
Tab("WebDev", "html5", "/admin/webdev")
|
||||||
|
|
||||||
|
27
pages/admin/shoboi.go
Normal file
27
pages/admin/shoboi.go
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package admin
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
"sort"
|
||||||
|
|
||||||
|
"github.com/aerogo/aero"
|
||||||
|
"github.com/animenotifier/arn"
|
||||||
|
"github.com/animenotifier/notify.moe/components"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Shoboi ...
|
||||||
|
func Shoboi(ctx *aero.Context) string {
|
||||||
|
missing, err := arn.FilterAnime(func(anime *arn.Anime) bool {
|
||||||
|
return anime.GetMapping("shoboi/anime") == ""
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
ctx.Error(http.StatusInternalServerError, "Couldn't filter anime", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
sort.Slice(missing, func(i, j int) bool {
|
||||||
|
return missing[i].StartDate > missing[j].StartDate
|
||||||
|
})
|
||||||
|
|
||||||
|
return ctx.HTML(components.ShoboiMissingMapping(missing))
|
||||||
|
}
|
16
pages/admin/shoboi.pixy
Normal file
16
pages/admin/shoboi.pixy
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
component ShoboiMissingMapping(missing []*arn.Anime)
|
||||||
|
h1.page-title Anime without Shoboi links
|
||||||
|
|
||||||
|
AdminTabs
|
||||||
|
|
||||||
|
table
|
||||||
|
tbody
|
||||||
|
each anime in missing
|
||||||
|
tr
|
||||||
|
td
|
||||||
|
if len(anime.StartDate) >= 4
|
||||||
|
span= anime.StartDate[:4]
|
||||||
|
td
|
||||||
|
a(href=anime.Link(), target="_blank", rel="noopener")= anime.Title.Canonical
|
||||||
|
td
|
||||||
|
a(href="http://cal.syoboi.jp/find?type=quick&sd=1&kw=" + anime.Title.Japanese, target="_blank", rel="noopener") Search
|
1
tests.go
1
tests.go
@ -230,6 +230,7 @@ var routeTests = map[string][]string{
|
|||||||
"/new/thread": nil,
|
"/new/thread": nil,
|
||||||
"/new/soundtrack": nil,
|
"/new/soundtrack": nil,
|
||||||
"/admin/anilist": nil,
|
"/admin/anilist": nil,
|
||||||
|
"/admin/shoboi": nil,
|
||||||
"/user": nil,
|
"/user": nil,
|
||||||
"/settings": nil,
|
"/settings": nil,
|
||||||
"/extension/embed": nil,
|
"/extension/embed": nil,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user