package finder import ( "net/http" "github.com/gin-gonic/gin" ) func (f *FinderApplication) Routes(routes *gin.RouterGroup) { routes.GET("render", func(ctx *gin.Context) { isMobileParam := ctx.Query("isMobile") isMobile := isMobileParam == "true" admin := true if isMobile { ctx.HTML(http.StatusOK, "finder/mobile-app.tmpl", f.Render(isMobile)) return } if admin { ctx.HTML(http.StatusOK, "finder/admin-app.tmpl", f.Render(isMobile)) return } ctx.HTML(http.StatusOK, "finder/app.tmpl", f.Render(isMobile)) }) routes.GET("renderMobileDesktop", func(ctx *gin.Context) { ctx.HTML(http.StatusOK, "finder/mobile-desktop.tmpl", gin.H{}) }) routes.GET("renderDesktop", func(ctx *gin.Context) { path := ctx.Query("path") if path == "" { ctx.JSON(http.StatusBadRequest, "no path provided") return } ctx.HTML(http.StatusOK, "finder/desktop.tmpl", gin.H{}) }) routes.GET("contextMenu", func(ctx *gin.Context) { context := ctx.Query("context") data := ctx.Query("data") ginH := f.RenderContextMenu(context, data) ctx.HTML(http.StatusOK, "wde-widgets/context-menu.tmpl", ginH) }) routes.GET("renderProps", func(ctx *gin.Context) { filePath := ctx.Query("path") ginH := f.RenderProps(filePath) ctx.HTML(http.StatusOK, "finder/props.tmpl", ginH) }) }