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/character"
|
||||||
"github.com/animenotifier/notify.moe/pages/dashboard"
|
"github.com/animenotifier/notify.moe/pages/dashboard"
|
||||||
"github.com/animenotifier/notify.moe/pages/editanime"
|
"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/embed"
|
||||||
"github.com/animenotifier/notify.moe/pages/explore"
|
"github.com/animenotifier/notify.moe/pages/explore"
|
||||||
"github.com/animenotifier/notify.moe/pages/forum"
|
"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/threads"
|
||||||
"github.com/animenotifier/notify.moe/pages/user"
|
"github.com/animenotifier/notify.moe/pages/user"
|
||||||
"github.com/animenotifier/notify.moe/pages/users"
|
"github.com/animenotifier/notify.moe/pages/users"
|
||||||
"github.com/animenotifier/notify.moe/pages/webdev"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var app = aero.New()
|
var app = aero.New()
|
||||||
@ -94,6 +92,8 @@ func configure(app *aero.Application) *aero.Application {
|
|||||||
app.Ajax("/users/osu", users.Osu)
|
app.Ajax("/users/osu", users.Osu)
|
||||||
app.Ajax("/users/staff", users.Staff)
|
app.Ajax("/users/staff", users.Staff)
|
||||||
app.Ajax("/users/anime/watching", users.AnimeWatching)
|
app.Ajax("/users/anime/watching", users.AnimeWatching)
|
||||||
|
app.Ajax("/statistics", statistics.Get)
|
||||||
|
app.Ajax("/statistics/anime", statistics.Anime)
|
||||||
app.Ajax("/login", login.Get)
|
app.Ajax("/login", login.Get)
|
||||||
|
|
||||||
// User profiles
|
// User profiles
|
||||||
@ -125,10 +125,8 @@ func configure(app *aero.Application) *aero.Application {
|
|||||||
|
|
||||||
// Admin
|
// Admin
|
||||||
app.Ajax("/admin", admin.Get)
|
app.Ajax("/admin", admin.Get)
|
||||||
app.Ajax("/editor", editor.Get)
|
app.Ajax("/admin/anilist", admin.AniList)
|
||||||
app.Ajax("/statistics", statistics.Get)
|
app.Ajax("/admin/webdev", admin.WebDev)
|
||||||
app.Ajax("/statistics/anime", statistics.Anime)
|
|
||||||
app.Ajax("/webdev", webdev.Get)
|
|
||||||
|
|
||||||
// Import
|
// Import
|
||||||
app.Ajax("/import", listimport.Get)
|
app.Ajax("/import", listimport.Get)
|
||||||
|
@ -23,7 +23,7 @@ component Sidebar(user *arn.User)
|
|||||||
SidebarButton("Statistics", "/statistics", "pie-chart")
|
SidebarButton("Statistics", "/statistics", "pie-chart")
|
||||||
SidebarButton("Settings", "/settings", "cog")
|
SidebarButton("Settings", "/settings", "cog")
|
||||||
|
|
||||||
if user.Role == "admin"
|
if user.Role == "admin" || user.Role == "editor"
|
||||||
SidebarButton("Admin", "/admin", "wrench")
|
SidebarButton("Admin", "/admin", "wrench")
|
||||||
|
|
||||||
.spacer
|
.spacer
|
||||||
|
@ -1,12 +1,7 @@
|
|||||||
component StatusTabs(urlPrefix string)
|
component StatusTabs(urlPrefix string)
|
||||||
.tabs.status-tabs
|
.tabs
|
||||||
StatusTab("Watching", "play", urlPrefix + "/watching")
|
Tab("Watching", "play", urlPrefix + "/watching")
|
||||||
StatusTab("Completed", "check", urlPrefix + "/completed")
|
Tab("Completed", "check", urlPrefix + "/completed")
|
||||||
StatusTab("Planned", "forward", urlPrefix + "/planned")
|
Tab("Planned", "forward", urlPrefix + "/planned")
|
||||||
StatusTab("On Hold", "pause", urlPrefix + "/hold")
|
Tab("On Hold", "pause", urlPrefix + "/hold")
|
||||||
StatusTab("Dropped", "stop", urlPrefix + "/dropped")
|
Tab("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
|
|
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 {
|
func Get(ctx *aero.Context) string {
|
||||||
user := utils.GetUser(ctx)
|
user := utils.GetUser(ctx)
|
||||||
|
|
||||||
if user == nil || user.Role != "admin" {
|
if user == nil || (user.Role != "admin" && user.Role != "editor") {
|
||||||
return ctx.Redirect("/")
|
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)
|
component Admin(user *arn.User, cpuUsage, memUsage, diskUsage float64, platform, family, platformVersion, kernelVersion string)
|
||||||
h1.page-title Admin Panel
|
h1.page-title Admin Panel
|
||||||
|
|
||||||
|
AdminTabs
|
||||||
|
|
||||||
.widgets
|
.widgets
|
||||||
.widget.mountable
|
.widget.mountable
|
||||||
h3.widget-title Usage
|
h3.widget-title Usage
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package editor
|
package admin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -9,8 +9,8 @@ import (
|
|||||||
"github.com/animenotifier/notify.moe/components"
|
"github.com/animenotifier/notify.moe/components"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Get ...
|
// AniList ...
|
||||||
func Get(ctx *aero.Context) string {
|
func AniList(ctx *aero.Context) string {
|
||||||
missing, err := arn.FilterAnime(func(anime *arn.Anime) bool {
|
missing, err := arn.FilterAnime(func(anime *arn.Anime) bool {
|
||||||
return anime.GetMapping("anilist/anime") == ""
|
return anime.GetMapping("anilist/anime") == ""
|
||||||
})
|
})
|
@ -1,5 +1,7 @@
|
|||||||
component AniListMissingMapping(missing []*arn.Anime)
|
component AniListMissingMapping(missing []*arn.Anime)
|
||||||
h1 Anime without Anilist links
|
h1.page-title Anime without Anilist links
|
||||||
|
|
||||||
|
AdminTabs
|
||||||
|
|
||||||
table
|
table
|
||||||
tbody
|
tbody
|
@ -1,9 +1,9 @@
|
|||||||
package webdev
|
package admin
|
||||||
|
|
||||||
import "github.com/aerogo/aero"
|
import "github.com/aerogo/aero"
|
||||||
import "github.com/animenotifier/notify.moe/components"
|
import "github.com/animenotifier/notify.moe/components"
|
||||||
|
|
||||||
// Get ...
|
// WebDev ...
|
||||||
func Get(ctx *aero.Context) string {
|
func WebDev(ctx *aero.Context) string {
|
||||||
return ctx.HTML(components.WebDev())
|
return ctx.HTML(components.WebDev())
|
||||||
}
|
}
|
@ -1,6 +1,8 @@
|
|||||||
component WebDev
|
component WebDev
|
||||||
h1.page-title WebDev
|
h1.page-title WebDev
|
||||||
|
|
||||||
|
AdminTabs
|
||||||
|
|
||||||
.light-button-group
|
.light-button-group
|
||||||
a.light-button(href="https://developers.google.com/speed/pagespeed/insights/?url=https://notify.moe/&tab=desktop", target="_blank", rel="noopener")
|
a.light-button(href="https://developers.google.com/speed/pagespeed/insights/?url=https://notify.moe/&tab=desktop", target="_blank", rel="noopener")
|
||||||
Icon("external-link")
|
Icon("external-link")
|
@ -13,18 +13,4 @@
|
|||||||
transition filter transition-speed ease, opacity transition-speed ease
|
transition filter transition-speed ease, opacity transition-speed ease
|
||||||
|
|
||||||
:hover
|
:hover
|
||||||
filter saturate(1.3)
|
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
|
|
2
tests.go
2
tests.go
@ -229,7 +229,7 @@ var routeTests = map[string][]string{
|
|||||||
"/anime/:id/edit": nil,
|
"/anime/:id/edit": nil,
|
||||||
"/new/thread": nil,
|
"/new/thread": nil,
|
||||||
"/new/soundtrack": nil,
|
"/new/soundtrack": nil,
|
||||||
"/editor": nil,
|
"/admin/anilist": nil,
|
||||||
"/user": nil,
|
"/user": nil,
|
||||||
"/settings": nil,
|
"/settings": nil,
|
||||||
"/extension/embed": nil,
|
"/extension/embed": nil,
|
||||||
|
Loading…
Reference in New Issue
Block a user