From 2bb6f391db693158ef8bcd92c357b425ae5b4ebf Mon Sep 17 00:00:00 2001 From: milovann Date: Mon, 15 Apr 2024 20:19:44 +0200 Subject: [PATCH] [SLOYD] Add pyscript --- routers/web/playground.go | 7 +++++++ routers/web/web.go | 1 + templates/playground/footer.tmpl | 1 + templates/playground/header.tmpl | 3 +++ templates/playground/pyscript.tmpl | 11 +++++++++++ 5 files changed, 23 insertions(+) create mode 100644 templates/playground/footer.tmpl create mode 100644 templates/playground/pyscript.tmpl diff --git a/routers/web/playground.go b/routers/web/playground.go index 83aa32e828..15d697e6e7 100644 --- a/routers/web/playground.go +++ b/routers/web/playground.go @@ -13,6 +13,7 @@ import ( const ( tplPlayground base.TplName = "playground/playground" tplPlaygroundReplIframe base.TplName = "playground/repl-iframe" + tplPlaygroundPyScript base.TplName = "playground/pyscript" ) func PlaygroundReplIframe(ctx *context.Context) { @@ -20,6 +21,12 @@ func PlaygroundReplIframe(ctx *context.Context) { ctx.HTML(http.StatusOK, tplPlaygroundReplIframe) } +func PlaygroundPyScript(ctx *context.Context) { + + ctx.Data["PageIsPlayground"] = true + ctx.HTML(http.StatusOK, tplPlaygroundPyScript) +} + func Playground(ctx *context.Context) { if ctx.IsSigned { ctx.Data["UserName"] = ctx.Doer.DisplayName() diff --git a/routers/web/web.go b/routers/web/web.go index c8519e4af5..a46ce3b5d8 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -472,6 +472,7 @@ func registerRoutes(m *web.Route) { m.Get("/", Home) m.Get("/playground", Playground) m.Get("/playground/repl-iframe", PlaygroundReplIframe) + m.Get("/playground/pyscript", PlaygroundPyScript) m.Get("/sitemap.xml", sitemapEnabled, ignExploreSignIn, HomeSitemap) m.Group("/.well-known", func() { m.Get("/openid-configuration", auth.OIDCWellKnown) diff --git a/templates/playground/footer.tmpl b/templates/playground/footer.tmpl new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/templates/playground/footer.tmpl @@ -0,0 +1 @@ + diff --git a/templates/playground/header.tmpl b/templates/playground/header.tmpl index 8a593c9266..6e93464cc5 100644 --- a/templates/playground/header.tmpl +++ b/templates/playground/header.tmpl @@ -7,6 +7,9 @@ {{svg "octicon-terminal"}} Repl + + {{svg "octicon-paper-airplane"}} PyScript + diff --git a/templates/playground/pyscript.tmpl b/templates/playground/pyscript.tmpl new file mode 100644 index 0000000000..5225d97dbe --- /dev/null +++ b/templates/playground/pyscript.tmpl @@ -0,0 +1,11 @@ + +{{template "base/head" .}} + +{{template "playground/header" .}} + + + +
+ + +{{template "base/footer" .}}