From 1a5ea40711e35f8b108d10a0667423926d63fd34 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Sun, 29 Aug 2021 10:54:13 -0400 Subject: Add Post Analysis form hints to admin page --- Biz/Dragons.hs | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/Biz/Dragons.hs b/Biz/Dragons.hs index d370693..4294172 100644 --- a/Biz/Dragons.hs +++ b/Biz/Dragons.hs @@ -1154,14 +1154,7 @@ instance Lucid.ToHtml AdminDashboard where Lucid.h2_ <| Lucid.toHtml <| "Total Analyses: " <> tshow totalAnalyses Lucid.section_ <| do Lucid.h2_ "Post analysis" - let action = linkAction_ "/" <| fieldLink postAnalysis - Lucid.form_ [action, Lucid.method_ "post"] <| do - Lucid.input_ [Lucid.type_ "text", Lucid.name_ "owner"] - Lucid.input_ [Lucid.type_ "text", Lucid.name_ "repo"] - Lucid.input_ - [ Lucid.type_ "submit" - ] - + Lucid.toHtml <| SubmitAnalysis "github" "training-kit" Lucid.section_ <| do Lucid.h2_ "All Users" Lucid.ul_ @@ -1484,6 +1477,27 @@ data SubmitAnalysis = SubmitAnalysis instance Web.FromForm SubmitAnalysis +instance Lucid.ToHtml SubmitAnalysis where + toHtmlRaw = Lucid.toHtml + toHtml SubmitAnalysis {..} = do + let action = linkAction_ "/" <| fieldLink postAnalysis + Lucid.form_ [action, Lucid.method_ "post"] <| do + Lucid.input_ + [ Lucid.type_ "text", + Lucid.name_ "owner", + Lucid.placeholder_ "owner", + Lucid.value_ owner + ] + Lucid.input_ + [ Lucid.type_ "text", + Lucid.name_ "repo", + Lucid.placeholder_ "repo", + Lucid.value_ repo + ] + Lucid.input_ + [ Lucid.type_ "submit" + ] + -- | I need more information than just 'Analysis' has to render a full, useful -- web page, hence this type. data AnalysisDisplay = AnalysisDisplay User AnalysisAction -- cgit v1.2.3