mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-02-09 09:37:31 +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'
|
, hqiLimitTo = count'
|
||||||
, hqiOffsetBy = offset
|
, hqiOffsetBy = offset
|
||||||
}
|
}
|
||||||
Nothing -> return $ HoogleQueryBad "No query provided"
|
Nothing -> return $ HoogleQueryOutput "" [] Nothing
|
||||||
let q = fromMaybe "" mquery
|
let queryText = fromMaybe "" mquery
|
||||||
pageLink p = (HoogleR slug
|
pageLink p = (HoogleR slug
|
||||||
, (if exact then (("exact", "true"):) else id)
|
, (if exact then (("exact", "true"):) else id)
|
||||||
$ (maybe id (\q' -> (("q", q'):)) mquery)
|
$ (maybe id (\q' -> (("q", q'):)) mquery)
|
||||||
[("page", tshow p)])
|
[("page", tshow p)])
|
||||||
|
snapshotLink = SnapshotR slug StackageHomeR
|
||||||
hoogleForm = $(widgetFile "hoogle-form")
|
hoogleForm = $(widgetFile "hoogle-form")
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
setTitle "Hoogle Search"
|
setTitle "Hoogle Search"
|
||||||
|
|||||||
@ -21,6 +21,10 @@ getStackageHomeR slug = do
|
|||||||
then Just False
|
then Just False
|
||||||
else Nothing
|
else Nothing
|
||||||
base = maybe 0 (const 1) minclusive :: Int
|
base = maybe 0 (const 1) minclusive :: Int
|
||||||
|
hoogleForm =
|
||||||
|
let queryText = "" :: Text
|
||||||
|
exact = False
|
||||||
|
in $(widgetFile "hoogle-form")
|
||||||
Entity sid _stackage <- runDB $ getBy404 $ UniqueSnapshot slug
|
Entity sid _stackage <- runDB $ getBy404 $ UniqueSnapshot slug
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
setTitle $ toHtml $ stackageTitle stackage
|
setTitle $ toHtml $ stackageTitle stackage
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<form action=@{HoogleR slug}>
|
<form .hoogle action=@{HoogleR slug}>
|
||||||
<input type=search autofocus name=q value=#{q} placeholder="Hoogle Search Phrase" .search>
|
<input type=search autofocus name=q value=#{queryText} placeholder="Hoogle Search Phrase" .search>
|
||||||
<input .btn type="submit" value="Search">
|
<input .btn type="submit" value="Search">
|
||||||
<label .checkbox .exact-lookup for=exact title="Only find identifiers matching your search term precisely">
|
<label .checkbox .exact-lookup for=exact title="Only find identifiers matching your search term precisely">
|
||||||
<input type=checkbox name=exact :exact:checked #exact>
|
<input type=checkbox name=exact :exact:checked #exact>
|
||||||
|
|||||||
@ -1,8 +1,14 @@
|
|||||||
input[type=submit] {
|
form.hoogle {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 20px;
|
||||||
|
.search {
|
||||||
|
width: 25em;
|
||||||
|
}
|
||||||
|
input {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.exact-lookup {
|
.exact-lookup {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-left: 0.5em;
|
margin-left: 1em;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
<div .container>
|
<div .container>
|
||||||
<div .content>
|
<div .content>
|
||||||
<h1>Hoogle Search
|
<h1>Hoogle Search
|
||||||
|
<p>Within <a href=@{snapshotLink}>#{stackageTitle stackage}</a>
|
||||||
^{hoogleForm}
|
^{hoogleForm}
|
||||||
$case mresults
|
$case mresults
|
||||||
$of HoogleQueryBad _err
|
$of HoogleQueryBad err
|
||||||
$of HoogleQueryOutput query results mtotalCount
|
<p>#{err}
|
||||||
<p>Searched for: #{preEscapedToHtml query}
|
<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
|
$if null results
|
||||||
<p>Your search produced no results.
|
<p>Your search produced no results.
|
||||||
$else
|
$else
|
||||||
|
|||||||
@ -6,6 +6,16 @@ ol.search-results {
|
|||||||
|
|
||||||
.self {
|
.self {
|
||||||
margin-bottom: 0;
|
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 {
|
table.sources {
|
||||||
@ -24,7 +34,7 @@ table.sources {
|
|||||||
|
|
||||||
.docs {
|
.docs {
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
background: #f8f8f8;
|
background: #e8e8e8;
|
||||||
}
|
}
|
||||||
|
|
||||||
.docs, .nodocs {
|
.docs, .nodocs {
|
||||||
|
|||||||
@ -38,8 +38,10 @@ $newline never
|
|||||||
<a href=@{SnapshotR slug StackageCabalConfigR}?global=true>
|
<a href=@{SnapshotR slug StackageCabalConfigR}?global=true>
|
||||||
the global configuration instructions
|
the global configuration instructions
|
||||||
|
|
||||||
<h3>
|
<h3>Hoogle
|
||||||
Packages
|
^{hoogleForm}
|
||||||
|
|
||||||
|
<h3>Packages
|
||||||
|
|
||||||
<div .container .content>
|
<div .container .content>
|
||||||
<div .packages>
|
<div .packages>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user