package wde import ( "net/http" "github.com/gin-contrib/location" "github.com/gin-gonic/gin" ) func PublicRoutes(route *gin.RouterGroup, wde *WDE) { route.GET("/getbasicwindow", func(ctx *gin.Context) { //TODO Rename to renderGenericWindowFrame ctx.HTML(http.StatusOK, "basic-window.html", nil) }) route.GET("/renderMobileDesktop", func(ctx *gin.Context) { ctx.HTML(http.StatusOK, "base/mobile-desktop.tmpl", nil) }) widgets := route.Group("widgets") { widgets.GET("/file-tile-view", func(ctx *gin.Context) { url := location.Get(ctx) path := ctx.Query("path") if path == "" { ctx.JSON(http.StatusBadRequest, "TODO") //TODO json error struct return } ginH, err := wde.RenderFileTileView(path, url.Scheme+"://"+url.Host) if err != nil { ctx.JSON(http.StatusInternalServerError, "TODO") //TODO return } ctx.HTML(http.StatusOK, "wde-widgets/file-tile-view.tmpl", ginH) }) } }