Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Network/Gitit/Handlers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ goToPage = withData $ \(params :: Params) -> do

searchResults :: Handler
searchResults = withData $ \(params :: Params) -> do
let patterns = pPatterns params `orIfNull` [pGotoPage params]
let patterns = if pExactPhrase params
then [unwords (pPatterns params)]
else pPatterns params `orIfNull` [pGotoPage params]
fs <- getFileStore
matchLines <- if null patterns
then return []
Expand Down
3 changes: 3 additions & 0 deletions Network/Gitit/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ data Params = Params { pUsername :: String
, pSince :: Maybe UTCTime
, pRaw :: String
, pLimit :: Int
, pExactPhrase :: Bool
, pPatterns :: [String]
, pGotoPage :: String
, pFileToDelete :: String
Expand Down Expand Up @@ -318,6 +319,7 @@ instance FromData Params where
ds <- look' "destination" `mplus` return ""
ra <- look' "raw" `mplus` return ""
lt <- lookRead "limit" `mplus` return 100
ph <- (look' "exactphrase" >> return True) `mplus` return False
pa <- look' "patterns" `mplus` return ""
gt <- look' "gotopage" `mplus` return ""
ft <- look' "filetodelete" `mplus` return ""
Expand Down Expand Up @@ -357,6 +359,7 @@ instance FromData Params where
, pDestination = ds
, pRaw = ra
, pLimit = lt
, pExactPhrase = ph
, pPatterns = words pa
, pGotoPage = gt
, pFileToDelete = ft
Expand Down
9 changes: 5 additions & 4 deletions data/templates/sitenav.st
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
$endif$
<li><a href="$base$/Help">Help</a></li>
</ul>
<form action="$base$/_search" method="get" id="searchform">
<input type="text" name="patterns" id="patterns"/>
<input type="submit" name="search" id="search" value="Search"/>
</form>
<form action="$base$/_go" method="post" id="goform">
<input type="text" name="gotopage" id="gotopage"/>
<input type="submit" name="go" id="go" value="Go"/>
</form>
<form action="$base$/_search" method="get" id="searchform">
<input type="text" name="patterns" id="patterns"/>
<input type="submit" name="search" id="search" value="Search"/><br\>
<input type="checkbox" name="exactphrase" id="exactphrase">&nbsp;Exact Phrase
</form>
</fieldset>
</div>