~alcinnz/amphiarao

ref: afb3d55d04613738265bc5b5e7f7ec2eff8904e7 amphiarao/src/UI/Search.hs -rw-r--r-- 813 bytes
afb3d55d — Adrian Cochrane Allow navigating (tab) history. 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{-# 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 Messages

import Network.URI (parseAbsoluteURI)

engines :: [(
    [Text] -> Html,
    String -> Session' -> [[Text] -> Html]
  )]
engines = [
    (const "URL", offerToLoad)
  ]

offerToLoad q _ | Just _ <- parseAbsoluteURI q = [\langs -> 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" ! A.title (l' langs DebugLink') $ disclosure
  ]

result href' label = a ! href (stringValue href') ! target "preview" $ string label
disclosure = "⤷"