mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-01-11 19:58:28 +01:00
Tweak hoogle style and behavior #47
This commit is contained in:
parent
c791c81ede
commit
f635977b02
@ -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"
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<form action=@{HoogleR slug}>
|
||||
<input type=search autofocus name=q value=#{q} placeholder="Hoogle Search Phrase" .search>
|
||||
<form .hoogle action=@{HoogleR slug}>
|
||||
<input type=search autofocus name=q value=#{queryText} placeholder="Hoogle Search Phrase" .search>
|
||||
<input .btn type="submit" value="Search">
|
||||
<label .checkbox .exact-lookup for=exact title="Only find identifiers matching your search term precisely">
|
||||
<input type=checkbox name=exact :exact:checked #exact>
|
||||
|
||||
@ -1,8 +1,14 @@
|
||||
input[type=submit] {
|
||||
margin-bottom: 10px;
|
||||
form.hoogle {
|
||||
margin-bottom: 20px;
|
||||
.search {
|
||||
width: 25em;
|
||||
}
|
||||
input {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.exact-lookup {
|
||||
display: inline-block;
|
||||
margin-left: 0.5em;
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
<div .container>
|
||||
<div .content>
|
||||
<h1>Hoogle Search
|
||||
<p>Within <a href=@{snapshotLink}>#{stackageTitle stackage}</a>
|
||||
^{hoogleForm}
|
||||
$case mresults
|
||||
$of HoogleQueryBad _err
|
||||
$of HoogleQueryOutput query results mtotalCount
|
||||
<p>Searched for: #{preEscapedToHtml query}
|
||||
$of HoogleQueryBad err
|
||||
<p>#{err}
|
||||
<p>For information on what queries should look like, see the <a href="http://www.haskell.org/haskellwiki/Hoogle">hoogle user manual</a>.
|
||||
$of HoogleQueryOutput _query results mtotalCount
|
||||
$if null results
|
||||
<p>Your search produced no results.
|
||||
$else
|
||||
|
||||
@ -6,6 +6,16 @@ ol.search-results {
|
||||
|
||||
.self {
|
||||
margin-bottom: 0;
|
||||
/* Use bold instead of italics to indicate matching part of search */
|
||||
a {
|
||||
b {
|
||||
font-weight: normal;
|
||||
}
|
||||
i {
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
table.sources {
|
||||
@ -24,7 +34,7 @@ table.sources {
|
||||
|
||||
.docs {
|
||||
white-space: pre-wrap;
|
||||
background: #f8f8f8;
|
||||
background: #e8e8e8;
|
||||
}
|
||||
|
||||
.docs, .nodocs {
|
||||
|
||||
@ -38,8 +38,10 @@ $newline never
|
||||
<a href=@{SnapshotR slug StackageCabalConfigR}?global=true>
|
||||
the global configuration instructions
|
||||
|
||||
<h3>
|
||||
Packages
|
||||
<h3>Hoogle
|
||||
^{hoogleForm}
|
||||
|
||||
<h3>Packages
|
||||
|
||||
<div .container .content>
|
||||
<div .packages>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user