From f635977b0244995d238d8bd939ef3f9c6026a50c Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Sat, 27 Dec 2014 19:57:24 -0800 Subject: [PATCH] Tweak hoogle style and behavior #47 --- Handler/Hoogle.hs | 5 +++-- Handler/StackageHome.hs | 4 ++++ templates/hoogle-form.hamlet | 4 ++-- templates/hoogle-form.lucius | 12 +++++++++--- templates/hoogle.hamlet | 8 +++++--- templates/hoogle.lucius | 12 +++++++++++- templates/stackage-home.hamlet | 6 ++++-- 7 files changed, 38 insertions(+), 13 deletions(-) diff --git a/Handler/Hoogle.hs b/Handler/Hoogle.hs index a5fa016..5ed65b7 100644 --- a/Handler/Hoogle.hs +++ b/Handler/Hoogle.hs @@ -37,12 +37,13 @@ getHoogleR slug = do , hqiLimitTo = count' , hqiOffsetBy = offset } - Nothing -> return $ HoogleQueryBad "No query provided" - let q = fromMaybe "" mquery + Nothing -> return $ HoogleQueryOutput "" [] Nothing + let queryText = fromMaybe "" mquery pageLink p = (HoogleR slug , (if exact then (("exact", "true"):) else id) $ (maybe id (\q' -> (("q", q'):)) mquery) [("page", tshow p)]) + snapshotLink = SnapshotR slug StackageHomeR hoogleForm = $(widgetFile "hoogle-form") defaultLayout $ do setTitle "Hoogle Search" diff --git a/Handler/StackageHome.hs b/Handler/StackageHome.hs index 1da0082..24fa0e1 100644 --- a/Handler/StackageHome.hs +++ b/Handler/StackageHome.hs @@ -21,6 +21,10 @@ getStackageHomeR slug = do then Just False else Nothing base = maybe 0 (const 1) minclusive :: Int + hoogleForm = + let queryText = "" :: Text + exact = False + in $(widgetFile "hoogle-form") Entity sid _stackage <- runDB $ getBy404 $ UniqueSnapshot slug defaultLayout $ do setTitle $ toHtml $ stackageTitle stackage diff --git a/templates/hoogle-form.hamlet b/templates/hoogle-form.hamlet index 5da79cf..6a2730b 100644 --- a/templates/hoogle-form.hamlet +++ b/templates/hoogle-form.hamlet @@ -1,5 +1,5 @@ -
- + +