Improved editor tools

This commit is contained in:
2017-10-06 22:07:12 +02:00
parent b250f2ea7e
commit c9f51037dc
11 changed files with 148 additions and 56 deletions

View File

@ -2,8 +2,10 @@ component AdminTabs
.tabs
Tab("Server", "server", "/admin")
Tab("WebDev", "html5", "/admin/webdev")
Tab("Shoboi", "calendar", "/admin/shoboi")
Tab("AniList", "list", "/admin/anilist")
a.tab.ajax(href="/editor", aria-label="Editor")
Icon("pencil")
span.tab-text Editor
component Admin(user *arn.User, cpuUsage, memUsage, diskUsage float64, platform, family, platformVersion, kernelVersion string)
h1.page-title Admin Panel

View File

@ -1,27 +0,0 @@
package admin
import (
"net/http"
"sort"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
)
// AniList ...
func AniList(ctx *aero.Context) string {
missing, err := arn.FilterAnime(func(anime *arn.Anime) bool {
return anime.GetMapping("anilist/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.AniListMissingMapping(missing))
}

View File

@ -1,16 +0,0 @@
component AniListMissingMapping(missing []*arn.Anime)
h1.page-title Anime without Anilist 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="https://anilist.co/search?type=anime&q=" + anime.Title.Canonical, target="_blank", rel="noopener") Search

View File

@ -1,27 +0,0 @@
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))
}

View File

@ -1,16 +0,0 @@
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

View File

@ -2,44 +2,47 @@ component WebDev
AdminTabs
h1.page-title WebDev
h2 Tests
.buttons
a.button.mountable(href="https://developers.google.com/speed/pagespeed/insights/?url=https://notify.moe/&tab=desktop", target="_blank", rel="noopener")
Icon("external-link")
span Google PageSpeed
a.button.mountable(href="https://observatory.mozilla.org/analyze.html?host=notify.moe", target="_blank", rel="noopener")
Icon("external-link")
span Mozilla Observatory
a.button.mountable(href="https://html5.validator.nu/?doc=https://notify.moe", target="_blank", rel="noopener")
Icon("external-link")
span HTML5 Validator
a.button.mountable(href="https://testmysite.withgoogle.com/", target="_blank", rel="noopener")
Icon("external-link")
span Mobile Speed
a.button.mountable(href="https://www.webpagetest.org/", target="_blank", rel="noopener")
Icon("external-link")
span Web Page Test
h2 Browser Support
.widgets
.widget.mountable
h3.widget-title Tests
.buttons
a.button.mountable(href="http://caniuse.com/#feat=webp", target="_blank", rel="noopener")
Icon("external-link")
span WebP
a.button.mountable(href="http://caniuse.com/#feat=push-api", target="_blank", rel="noopener")
Icon("external-link")
span Push API
a.button.mountable(href="http://caniuse.com/#feat=serviceworkers", target="_blank", rel="noopener")
Icon("external-link")
span Service Worker
a.button.mountable(href="http://caniuse.com/#feat=intersectionobserver", target="_blank", rel="noopener")
Icon("external-link")
span Intersection Observer
a.button.mountable(href="http://caniuse.com/#feat=requestidlecallback", target="_blank", rel="noopener")
Icon("external-link")
span Request Idle Callback
a.button.mountable(href="http://caniuse.com/#feat=css-variables", target="_blank", rel="noopener")
Icon("external-link")
span CSS Variables
.buttons
a.button.mountable(href="https://developers.google.com/speed/pagespeed/insights/?url=https://notify.moe/&tab=desktop", target="_blank", rel="noopener")
Icon("external-link")
span Google PageSpeed
a.button.mountable(href="https://observatory.mozilla.org/analyze.html?host=notify.moe", target="_blank", rel="noopener")
Icon("external-link")
span Mozilla Observatory
a.button.mountable(href="https://html5.validator.nu/?doc=https://notify.moe", target="_blank", rel="noopener")
Icon("external-link")
span HTML5 Validator
a.button.mountable(href="https://testmysite.withgoogle.com/", target="_blank", rel="noopener")
Icon("external-link")
span Mobile Speed
a.button.mountable(href="https://www.webpagetest.org/", target="_blank", rel="noopener")
Icon("external-link")
span Web Page Test
.widget.mountable
h3.widget-title Browser Support
.buttons
a.button.mountable(href="http://caniuse.com/#feat=webp", target="_blank", rel="noopener")
Icon("external-link")
span WebP
a.button.mountable(href="http://caniuse.com/#feat=push-api", target="_blank", rel="noopener")
Icon("external-link")
span Push API
a.button.mountable(href="http://caniuse.com/#feat=serviceworkers", target="_blank", rel="noopener")
Icon("external-link")
span Service Worker
a.button.mountable(href="http://caniuse.com/#feat=intersectionobserver", target="_blank", rel="noopener")
Icon("external-link")
span Intersection Observer
a.button.mountable(href="http://caniuse.com/#feat=requestidlecallback", target="_blank", rel="noopener")
Icon("external-link")
span Request Idle Callback
a.button.mountable(href="http://caniuse.com/#feat=css-variables", target="_blank", rel="noopener")
Icon("external-link")
span CSS Variables