parent
b65ccc292f
commit
12b06381ca
@ -0,0 +1,10 @@ |
||||
package admin |
||||
|
||||
import ( |
||||
"github.com/gofiber/fiber/v2" |
||||
"MY/webapp/admin/table" |
||||
) |
||||
|
||||
func Setup(app *fiber.App) { |
||||
admin_table.Setup(app) |
||||
} |
||||
@ -0,0 +1,11 @@ |
||||
package admin_table |
||||
|
||||
import ( |
||||
"github.com/gofiber/fiber/v2" |
||||
) |
||||
|
||||
func Setup(app *fiber.App) { |
||||
SetupApi(app) |
||||
SetupPages(app) |
||||
} |
||||
|
||||
@ -0,0 +1,28 @@ |
||||
package admin_table |
||||
|
||||
import ( |
||||
"github.com/gofiber/fiber/v2" |
||||
. "MY/webapp/common" |
||||
) |
||||
|
||||
func GetPageSelectOne(c *fiber.Ctx) error { |
||||
_, err := AuthCheck(c, true) |
||||
if err != nil { return c.Redirect("/") } |
||||
|
||||
table := c.Params("table") |
||||
id, err := c.ParamsInt("id", -1) |
||||
if err != nil || id < 0 { return IfErrNil(err, c) } |
||||
|
||||
return c.Render("admin/table/view", fiber.Map{ |
||||
"table": table, |
||||
"id": id, |
||||
}) |
||||
} |
||||
|
||||
func SetupPages(app *fiber.App) { |
||||
AddAuthedPage(app, true, "admin/table/", "admin/table/index") |
||||
AddAuthedPage(app, true, "admin/table/:table/", "admin/table/contents") |
||||
AddAuthedPage(app, true, "admin/table/new/:table/", "admin/table/new") |
||||
|
||||
app.Get("/admin/table/:table/:id/", GetPageSelectOne) |
||||
} |
||||
Loading…
Reference in new issue