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/anime"
|
||||||
"github.com/animenotifier/notify.moe/pages/animelist"
|
"github.com/animenotifier/notify.moe/pages/animelist"
|
||||||
"github.com/animenotifier/notify.moe/pages/animelistitem"
|
"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/best"
|
||||||
"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"
|
||||||
@ -59,6 +60,7 @@ func configure(app *aero.Application) *aero.Application {
|
|||||||
app.Ajax("/", dashboard.Get)
|
app.Ajax("/", dashboard.Get)
|
||||||
app.Ajax("/anime/:id", anime.Get)
|
app.Ajax("/anime/:id", anime.Get)
|
||||||
app.Ajax("/anime/:id/edit", editanime.Get)
|
app.Ajax("/anime/:id/edit", editanime.Get)
|
||||||
|
app.Ajax("/api", apiview.Get)
|
||||||
app.Ajax("/best/anime", best.Get)
|
app.Ajax("/best/anime", best.Get)
|
||||||
app.Ajax("/explore", explore.Get)
|
app.Ajax("/explore", explore.Get)
|
||||||
app.Ajax("/forum", forums.Get)
|
app.Ajax("/forum", forums.Get)
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
package admin
|
package admin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"sort"
|
|
||||||
|
|
||||||
"github.com/aerogo/aero"
|
"github.com/aerogo/aero"
|
||||||
"github.com/animenotifier/arn"
|
|
||||||
"github.com/animenotifier/notify.moe/components"
|
"github.com/animenotifier/notify.moe/components"
|
||||||
"github.com/animenotifier/notify.moe/utils"
|
"github.com/animenotifier/notify.moe/utils"
|
||||||
)
|
)
|
||||||
@ -17,13 +14,5 @@ func Get(ctx *aero.Context) string {
|
|||||||
return ctx.Redirect("/")
|
return ctx.Redirect("/")
|
||||||
}
|
}
|
||||||
|
|
||||||
types := []string{}
|
return ctx.HTML(components.Admin(user))
|
||||||
|
|
||||||
for typeName := range arn.DB.Types() {
|
|
||||||
types = append(types, typeName)
|
|
||||||
}
|
|
||||||
|
|
||||||
sort.Strings(types)
|
|
||||||
|
|
||||||
return ctx.HTML(components.Admin(user, types))
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
component Admin(user *arn.User, types []string)
|
component Admin(user *arn.User)
|
||||||
h2.page-title Admin Panel
|
h2.page-title Admin Panel
|
||||||
|
|
||||||
h3 Server
|
h3 Server
|
||||||
@ -16,16 +16,4 @@ component Admin(user *arn.User, types []string)
|
|||||||
td= runtime.NumGoroutine()
|
td= runtime.NumGoroutine()
|
||||||
tr
|
tr
|
||||||
td Go version:
|
td Go version:
|
||||||
td= runtime.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