39 lines
929 B
Go
39 lines
929 B
Go
package routewde
|
|
|
|
import (
|
|
"net/http"
|
|
"personalwebsite/wde"
|
|
|
|
"github.com/gin-contrib/location"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func Route(route *gin.RouterGroup, wde *wde.WDE) {
|
|
route.GET("/getbasicwindow", func(ctx *gin.Context) {
|
|
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)
|
|
_ = url
|
|
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)
|
|
})
|
|
}
|
|
}
|