Made /api page
This commit is contained in:
parent
715686ddee
commit
6e41c08e60
2
main.go
2
main.go
@ -12,6 +12,7 @@ import (
|
||||
"github.com/animenotifier/notify.moe/pages/anime"
|
||||
"github.com/animenotifier/notify.moe/pages/animelist"
|
||||
"github.com/animenotifier/notify.moe/pages/animelistitem"
|
||||
"github.com/animenotifier/notify.moe/pages/apiview"
|
||||
"github.com/animenotifier/notify.moe/pages/best"
|
||||
"github.com/animenotifier/notify.moe/pages/dashboard"
|
||||
"github.com/animenotifier/notify.moe/pages/editanime"
|
||||
@ -59,6 +60,7 @@ func configure(app *aero.Application) *aero.Application {
|
||||
app.Ajax("/", dashboard.Get)
|
||||
app.Ajax("/anime/:id", anime.Get)
|
||||
app.Ajax("/anime/:id/edit", editanime.Get)
|
||||
app.Ajax("/api", apiview.Get)
|
||||
app.Ajax("/best/anime", best.Get)
|
||||
app.Ajax("/explore", explore.Get)
|
||||
app.Ajax("/forum", forums.Get)
|
||||
|
@ -1,10 +1,7 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
"sort"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
)
|
||||
@ -17,13 +14,5 @@ func Get(ctx *aero.Context) string {
|
||||
return ctx.Redirect("/")
|
||||
}
|
||||
|
||||
types := []string{}
|
||||
|
||||
for typeName := range arn.DB.Types() {
|
||||
types = append(types, typeName)
|
||||
}
|
||||
|
||||
sort.Strings(types)
|
||||
|
||||
return ctx.HTML(components.Admin(user, types))
|
||||
return ctx.HTML(components.Admin(user))
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
component Admin(user *arn.User, types []string)
|
||||
component Admin(user *arn.User)
|
||||
h2.page-title Admin Panel
|
||||
|
||||
h3 Server
|
||||
@ -17,15 +17,3 @@ component Admin(user *arn.User, types []string)
|
||||
tr
|
||||
td Go version:
|
||||
td= runtime.Version()
|
||||
|
||||
h3 Types
|
||||
table
|
||||
//- thead
|
||||
//- tr
|
||||
//- th Table
|
||||
tbody
|
||||
each typeName in types
|
||||
tr
|
||||
td= typeName
|
||||
td
|
||||
a(href="/api/" + strings.ToLower(typeName) + "/")= "/api/" + strings.ToLower(typeName) + "/"
|
22
pages/apiview/api.go
Normal file
22
pages/apiview/api.go
Normal file
@ -0,0 +1,22 @@
|
||||
package apiview
|
||||
|
||||
import (
|
||||
"sort"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
)
|
||||
|
||||
// Get api page.
|
||||
func Get(ctx *aero.Context) string {
|
||||
types := []string{}
|
||||
|
||||
for typeName := range arn.DB.Types() {
|
||||
types = append(types, typeName)
|
||||
}
|
||||
|
||||
sort.Strings(types)
|
||||
|
||||
return ctx.HTML(components.API(types))
|
||||
}
|
14
pages/apiview/api.pixy
Normal file
14
pages/apiview/api.pixy
Normal file
@ -0,0 +1,14 @@
|
||||
component API(types []string)
|
||||
h2.page-title API
|
||||
|
||||
h3 Types
|
||||
table
|
||||
//- thead
|
||||
//- tr
|
||||
//- th Table
|
||||
tbody
|
||||
each typeName in types
|
||||
tr
|
||||
td= typeName
|
||||
td
|
||||
a(href="/api/" + strings.ToLower(typeName) + "/")= "/api/" + strings.ToLower(typeName) + "/"
|
Loading…
Reference in New Issue
Block a user