{-# LANGUAGE OverloadedStrings, ScopedTypeVariables #-} module UI.Search(engines) where import Text.Blaze.Html5 as H import Text.Blaze.Html5.Attributes as A import Text.Blaze.Html import Data.Text as Txt import Internal import Network.URI (parseAbsoluteURI) engines :: [( [Text] -> Html, String -> Session' -> [[Text] -> Html] )] engines = [ (const "URL", offerToLoad) ] offerToLoad q _ | Just _ <- parseAbsoluteURI q = [const $ do result q q H.form ! action "nav/load" ! method "POST" $ do input ! type_ "hidden" ! name "url" ! value (stringValue q) button ! type_ "submit" ! class_ "disclosure" $ disclosure ] result href' label = a ! href (stringValue href') ! target "preview" $ string label disclosure = "⤷"