From a52109529e3af8433a574eb10d00e435f0bc9b09 Mon Sep 17 00:00:00 2001 From: Adrian Cochrane Date: Sat, 26 Jun 2021 08:59:15 +1200 Subject: [PATCH] Show search queries in existing searchbox, not new one. --- src/Main.hs | 4 +--- src/UI/Templates.hs | 8 +++++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Main.hs b/src/Main.hs index e52f8e3..5976ac9 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -122,10 +122,8 @@ searchSession session = do results <- forM Q.engines $ \(header, engine) -> do results' <- liftIO $ engine q session session' return (header, labelEmpty results') - Tpl.inspector ok (Txt.pack ('🔎':q)) session' $ \langs -> H.main $ do + Tpl.inspector' q ok (Txt.pack ('🔎':q)) session' $ \langs -> H.main $ do H.aside $ do - H.form $ do - H.input H.! A.type_ "search" H.! A.name "q" H.! A.value (H.stringValue q) H.dl $ do forM results $ \(header, results') -> do H.dt $ header langs diff --git a/src/UI/Templates.hs b/src/UI/Templates.hs index dce8cd7..d3d2ebc 100644 --- a/src/UI/Templates.hs +++ b/src/UI/Templates.hs @@ -1,5 +1,5 @@ {-# LANGUAGE OverloadedStrings, ScopedTypeVariables #-} -module UI.Templates(page, inspector, sessionForm, +module UI.Templates(page, inspector, inspector', sessionForm, xmlNode, xmlNode', elSelector, elPage) where import Happstack.Lite @@ -31,7 +31,9 @@ page return' title class_ body' = do body ! A.class_ class_ $ body' langs inspector :: (Response -> ServerPart Response) -> Text -> Session' -> ([Text] -> Html) -> ServerPart Response -inspector return' title session' body' = do +inspector = inspector' "" +inspector' :: String -> (Response -> ServerPart Response) -> Text -> Session' -> ([Text] -> Html) -> ServerPart Response +inspector' q return' title session' body' = do let timeout = H.stringValue $ show $ pageLoad $ timeouts session' page return' [title, pack $ show $ currentURL $ session', "Amphiarao"] "fill" $ \langs -> do header $ do @@ -40,7 +42,7 @@ inspector return' title session' body' = do postButton "/nav/reload" (l' langs Reload') "↻" hr H.form ! action' ["/", uuid', "/search"] ! alt (l' langs Search') $ do - input ! type_ "search" ! name "q" ! placeholder (l' langs Search') + input ! type_ "search" ! name "q" ! value (stringValue q) ! placeholder (l' langs Search') body' langs footer $ do H.form ! action' ["/close/", uuid'] ! A.method "POST" ! alt (l' langs CloseSession') $ do -- 2.30.2