From 0b7d1e4bd0f21b612b8c8e39a5d928db32744338 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Sun, 4 Jan 2015 14:13:47 +0200 Subject: [PATCH] Make Hoogle URLs more consistent with other URLs --- Handler/Alias.hs | 2 ++ Handler/Hoogle.hs | 2 +- config/routes | 2 +- templates/hoogle-form.hamlet | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Handler/Alias.hs b/Handler/Alias.hs index c73016e..c3657ec 100644 --- a/Handler/Alias.hs +++ b/Handler/Alias.hs @@ -9,6 +9,7 @@ import Data.Slug (Slug) import Handler.StackageHome (getStackageHomeR, getStackageMetadataR, getStackageCabalConfigR, getSnapshotPackagesR, getDocsR) import Handler.StackageIndex (getStackageIndexR, getStackageBundleR) import Handler.StackageSdist (getStackageSdistR) +import Handler.Hoogle (getHoogleR) handleAliasR :: Slug -> Slug -> [Text] -> Handler () handleAliasR user name pieces = do @@ -77,4 +78,5 @@ goSid sid pieces = do StackageSdistR pnv -> getStackageSdistR slug pnv >>= sendResponse SnapshotPackagesR -> getSnapshotPackagesR slug >>= sendResponse DocsR -> getDocsR slug >>= sendResponse + HoogleR -> getHoogleR slug >>= sendResponse _ -> notFound diff --git a/Handler/Hoogle.hs b/Handler/Hoogle.hs index 4367367..ab551fc 100644 --- a/Handler/Hoogle.hs +++ b/Handler/Hoogle.hs @@ -46,7 +46,7 @@ getHoogleR slug = do } Nothing -> return $ HoogleQueryOutput "" [] Nothing let queryText = fromMaybe "" mquery - pageLink p = (HoogleR slug + pageLink p = (SnapshotR slug HoogleR , (if exact then (("exact", "true"):) else id) $ (maybe id (\q' -> (("q", q'):)) mquery) [("page", tshow p)]) diff --git a/config/routes b/config/routes index 2369518..fbb6d36 100644 --- a/config/routes +++ b/config/routes @@ -25,6 +25,7 @@ /package/#PackageNameVersion StackageSdistR GET /packages SnapshotPackagesR GET /docs DocsR GET + /hoogle HoogleR GET /hackage-view/#HackageView/00-index.tar.gz HackageViewIndexR GET /hackage-view/#HackageView/package/#PackageNameVersion HackageViewSdistR GET @@ -33,7 +34,6 @@ /progress/#Int ProgressR GET /system SystemR GET /haddock/#SnapSlug/*Texts HaddockR GET -/hoogle/#SnapSlug HoogleR GET /package/#PackageName PackageR GET /package/#PackageName/snapshots PackageSnapshotsR GET /package PackageListR GET diff --git a/templates/hoogle-form.hamlet b/templates/hoogle-form.hamlet index 6a2730b..cbde565 100644 --- a/templates/hoogle-form.hamlet +++ b/templates/hoogle-form.hamlet @@ -1,4 +1,4 @@ -
+