Improved admin panel
This commit is contained in:
parent
b0de2045d7
commit
cc2418cd96
10
main.go
10
main.go
@ -20,7 +20,6 @@ import (
|
||||
"github.com/animenotifier/notify.moe/pages/character"
|
||||
"github.com/animenotifier/notify.moe/pages/dashboard"
|
||||
"github.com/animenotifier/notify.moe/pages/editanime"
|
||||
"github.com/animenotifier/notify.moe/pages/editor"
|
||||
"github.com/animenotifier/notify.moe/pages/embed"
|
||||
"github.com/animenotifier/notify.moe/pages/explore"
|
||||
"github.com/animenotifier/notify.moe/pages/forum"
|
||||
@ -46,7 +45,6 @@ import (
|
||||
"github.com/animenotifier/notify.moe/pages/threads"
|
||||
"github.com/animenotifier/notify.moe/pages/user"
|
||||
"github.com/animenotifier/notify.moe/pages/users"
|
||||
"github.com/animenotifier/notify.moe/pages/webdev"
|
||||
)
|
||||
|
||||
var app = aero.New()
|
||||
@ -94,6 +92,8 @@ func configure(app *aero.Application) *aero.Application {
|
||||
app.Ajax("/users/osu", users.Osu)
|
||||
app.Ajax("/users/staff", users.Staff)
|
||||
app.Ajax("/users/anime/watching", users.AnimeWatching)
|
||||
app.Ajax("/statistics", statistics.Get)
|
||||
app.Ajax("/statistics/anime", statistics.Anime)
|
||||
app.Ajax("/login", login.Get)
|
||||
|
||||
// User profiles
|
||||
@ -125,10 +125,8 @@ func configure(app *aero.Application) *aero.Application {
|
||||
|
||||
// Admin
|
||||
app.Ajax("/admin", admin.Get)
|
||||
app.Ajax("/editor", editor.Get)
|
||||
app.Ajax("/statistics", statistics.Get)
|
||||
app.Ajax("/statistics/anime", statistics.Anime)
|
||||
app.Ajax("/webdev", webdev.Get)
|
||||
app.Ajax("/admin/anilist", admin.AniList)
|
||||
app.Ajax("/admin/webdev", admin.WebDev)
|
||||
|
||||
// Import
|
||||
app.Ajax("/import", listimport.Get)
|
||||
|
@ -23,7 +23,7 @@ component Sidebar(user *arn.User)
|
||||
SidebarButton("Statistics", "/statistics", "pie-chart")
|
||||
SidebarButton("Settings", "/settings", "cog")
|
||||
|
||||
if user.Role == "admin"
|
||||
if user.Role == "admin" || user.Role == "editor"
|
||||
SidebarButton("Admin", "/admin", "wrench")
|
||||
|
||||
.spacer
|
||||
|
@ -1,12 +1,7 @@
|
||||
component StatusTabs(urlPrefix string)
|
||||
.tabs.status-tabs
|
||||
StatusTab("Watching", "play", urlPrefix + "/watching")
|
||||
StatusTab("Completed", "check", urlPrefix + "/completed")
|
||||
StatusTab("Planned", "forward", urlPrefix + "/planned")
|
||||
StatusTab("On Hold", "pause", urlPrefix + "/hold")
|
||||
StatusTab("Dropped", "stop", urlPrefix + "/dropped")
|
||||
|
||||
component StatusTab(label string, icon string, url string)
|
||||
a.tab.status-tab.action(href=url, data-action="diff", data-trigger="click", aria-label=label)
|
||||
Icon(icon)
|
||||
span.tab-text= label
|
||||
.tabs
|
||||
Tab("Watching", "play", urlPrefix + "/watching")
|
||||
Tab("Completed", "check", urlPrefix + "/completed")
|
||||
Tab("Planned", "forward", urlPrefix + "/planned")
|
||||
Tab("On Hold", "pause", urlPrefix + "/hold")
|
||||
Tab("Dropped", "stop", urlPrefix + "/dropped")
|
4
mixins/Tab.pixy
Normal file
4
mixins/Tab.pixy
Normal file
@ -0,0 +1,4 @@
|
||||
component Tab(label string, icon string, url string)
|
||||
a.tab.action(href=url, data-action="diff", data-trigger="click", aria-label=label)
|
||||
Icon(icon)
|
||||
span.tab-text= label
|
@ -17,7 +17,7 @@ import (
|
||||
func Get(ctx *aero.Context) string {
|
||||
user := utils.GetUser(ctx)
|
||||
|
||||
if user == nil || user.Role != "admin" {
|
||||
if user == nil || (user.Role != "admin" && user.Role != "editor") {
|
||||
return ctx.Redirect("/")
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,14 @@
|
||||
component AdminTabs
|
||||
.tabs
|
||||
Tab("Server", "server", "/admin")
|
||||
Tab("AniList", "list", "/admin/anilist")
|
||||
Tab("WebDev", "html5", "/admin/webdev")
|
||||
|
||||
component Admin(user *arn.User, cpuUsage, memUsage, diskUsage float64, platform, family, platformVersion, kernelVersion string)
|
||||
h1.page-title Admin Panel
|
||||
|
||||
AdminTabs
|
||||
|
||||
.widgets
|
||||
.widget.mountable
|
||||
h3.widget-title Usage
|
||||
|
@ -1,4 +1,4 @@
|
||||
package editor
|
||||
package admin
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
@ -9,8 +9,8 @@ import (
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
)
|
||||
|
||||
// Get ...
|
||||
func Get(ctx *aero.Context) string {
|
||||
// AniList ...
|
||||
func AniList(ctx *aero.Context) string {
|
||||
missing, err := arn.FilterAnime(func(anime *arn.Anime) bool {
|
||||
return anime.GetMapping("anilist/anime") == ""
|
||||
})
|
@ -1,5 +1,7 @@
|
||||
component AniListMissingMapping(missing []*arn.Anime)
|
||||
h1 Anime without Anilist links
|
||||
h1.page-title Anime without Anilist links
|
||||
|
||||
AdminTabs
|
||||
|
||||
table
|
||||
tbody
|
@ -1,9 +1,9 @@
|
||||
package webdev
|
||||
package admin
|
||||
|
||||
import "github.com/aerogo/aero"
|
||||
import "github.com/animenotifier/notify.moe/components"
|
||||
|
||||
// Get ...
|
||||
func Get(ctx *aero.Context) string {
|
||||
// WebDev ...
|
||||
func WebDev(ctx *aero.Context) string {
|
||||
return ctx.HTML(components.WebDev())
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
component WebDev
|
||||
h1.page-title WebDev
|
||||
|
||||
AdminTabs
|
||||
|
||||
.light-button-group
|
||||
a.light-button(href="https://developers.google.com/speed/pagespeed/insights/?url=https://notify.moe/&tab=desktop", target="_blank", rel="noopener")
|
||||
Icon("external-link")
|
@ -13,18 +13,4 @@
|
||||
transition filter transition-speed ease, opacity transition-speed ease
|
||||
|
||||
:hover
|
||||
filter saturate(1.3)
|
||||
|
||||
.status-tabs
|
||||
// margin-top 2px
|
||||
// position fixed
|
||||
// top 4.6rem
|
||||
// right 1.6rem
|
||||
// flex-direction column
|
||||
|
||||
// .status-tab
|
||||
// font-size 0.9rem
|
||||
|
||||
// < 380px
|
||||
// .profile-watching-list
|
||||
// justify-content center
|
||||
filter saturate(1.3)
|
Loading…
Reference in New Issue
Block a user