Whole repo builds with new yesod-routes

This commit is contained in:
Michael Snoyman 2012-01-05 15:27:16 +02:00
parent 0a9df1076e
commit 69a5d0e0ed
11 changed files with 35 additions and 37 deletions

View File

@ -9,8 +9,9 @@
module Yesod.Auth module Yesod.Auth
( -- * Subsite ( -- * Subsite
Auth Auth
, AuthRoute
, Route (..)
, AuthPlugin (..) , AuthPlugin (..)
, AuthRoute (..)
, getAuth , getAuth
, YesodAuth (..) , YesodAuth (..)
-- * Plugin interface -- * Plugin interface
@ -53,6 +54,8 @@ import Yesod.Form (FormMessage)
data Auth = Auth data Auth = Auth
type AuthRoute = Route Auth
type Method = Text type Method = Text
type Piece = Text type Piece = Text

View File

@ -21,7 +21,7 @@ import Data.Maybe (fromMaybe)
pid :: Text pid :: Text
pid = "browserid" pid = "browserid"
complete :: AuthRoute complete :: Route Auth
complete = PluginR pid [] complete = PluginR pid []
authBrowserIdAudience :: YesodAuth m authBrowserIdAudience :: YesodAuth m

View File

@ -16,6 +16,7 @@ module Yesod.Form.Jquery
) where ) where
import Yesod.Handler import Yesod.Handler
import Yesod.Core (Route)
import Yesod.Form import Yesod.Form
import Yesod.Widget import Yesod.Widget
import Data.Time (UTCTime (..), Day, TimeOfDay (..), timeOfDayToTime, import Data.Time (UTCTime (..), Day, TimeOfDay (..), timeOfDayToTime,

View File

@ -11,6 +11,7 @@ module Yesod.Form.Nic
) where ) where
import Yesod.Handler import Yesod.Handler
import Yesod.Core (Route)
import Yesod.Form import Yesod.Form
import Yesod.Widget import Yesod.Widget
import Text.HTML.SanitizeXSS (sanitizeBalance) import Text.HTML.SanitizeXSS (sanitizeBalance)

View File

@ -22,9 +22,7 @@ module Yesod.AtomFeed
, module Yesod.FeedTypes , module Yesod.FeedTypes
) where ) where
import Yesod.Content import Yesod.Core
import Yesod.Handler
import Yesod.Widget
import Yesod.FeedTypes import Yesod.FeedTypes
import Text.Hamlet (HtmlUrl, xhamlet, hamlet) import Text.Hamlet (HtmlUrl, xhamlet, hamlet)
import qualified Data.ByteString.Char8 as S8 import qualified Data.ByteString.Char8 as S8

View File

@ -25,7 +25,7 @@ import Yesod.FeedTypes
import Yesod.AtomFeed import Yesod.AtomFeed
import Yesod.RssFeed import Yesod.RssFeed
import Yesod.Content (HasReps (chooseRep), typeAtom, typeRss) import Yesod.Content (HasReps (chooseRep), typeAtom, typeRss)
import Yesod.Handler (Route, GHandler) import Yesod.Core (Route, GHandler)
data RepAtomRss = RepAtomRss RepAtom RepRss data RepAtomRss = RepAtomRss RepAtom RepRss
instance HasReps RepAtomRss where instance HasReps RepAtomRss where

View File

@ -18,9 +18,7 @@ module Yesod.RssFeed
, module Yesod.FeedTypes , module Yesod.FeedTypes
) where ) where
import Yesod.Handler import Yesod.Core
import Yesod.Content
import Yesod.Widget
import Yesod.FeedTypes import Yesod.FeedTypes
import Text.Hamlet (HtmlUrl, xhamlet, hamlet) import Text.Hamlet (HtmlUrl, xhamlet, hamlet)
import qualified Data.ByteString.Char8 as S8 import qualified Data.ByteString.Char8 as S8

View File

@ -5,6 +5,7 @@ license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com> author: Michael Snoyman <michael@snoyman.com>
maintainer: Michael Snoyman <michael@snoyman.com> maintainer: Michael Snoyman <michael@snoyman.com>
synopsis: Efficient routing for Yesod. synopsis: Efficient routing for Yesod.
description: Provides an efficient routing system, a parser and TH code generation.
category: Web, Yesod category: Web, Yesod
stability: Stable stability: Stable
cabal-version: >= 1.8 cabal-version: >= 1.8

View File

@ -26,7 +26,7 @@ module Yesod.Sitemap
) where ) where
import Yesod.Content (RepXml (..), RepPlain (..), toContent, formatW3) import Yesod.Content (RepXml (..), RepPlain (..), toContent, formatW3)
import Yesod.Handler (Route, GHandler, getUrlRender) import Yesod.Core (Route, GHandler, getUrlRender)
import Yesod.Handler (hamletToContent) import Yesod.Handler (hamletToContent)
import Text.Hamlet (HtmlUrl, xhamlet) import Text.Hamlet (HtmlUrl, xhamlet)
import Data.Time (UTCTime) import Data.Time (UTCTime)

View File

@ -29,7 +29,7 @@
module Yesod.Static module Yesod.Static
( -- * Subsite ( -- * Subsite
Static (..) Static (..)
, StaticRoute (..) , Route (..)
-- * Smart constructor -- * Smart constructor
, static , static
, staticDevel , staticDevel
@ -120,36 +120,32 @@ embed fp =
{ ssFolder = embeddedLookup (toEmbedded $(embedDir fp)) { ssFolder = embeddedLookup (toEmbedded $(embedDir fp))
})|] })|]
instance RenderRoute Static where
-- | A route on the static subsite (see also 'staticFiles'). -- | A route on the static subsite (see also 'staticFiles').
-- --
-- You may use this constructor directly to manually link to a -- You may use this constructor directly to manually link to a
-- static file. The first argument is the sub-path to the file -- static file. The first argument is the sub-path to the file
-- being served whereas the second argument is the key-value -- being served whereas the second argument is the key-value
-- pairs in the query string. For example, -- pairs in the query string. For example,
-- --
-- > StaticRoute $ StaticR [\"thumb001.jpg\"] [(\"foo\", \"5\"), (\"bar\", \"choc\")] -- > StaticRoute $ StaticR [\"thumb001.jpg\"] [(\"foo\", \"5\"), (\"bar\", \"choc\")]
-- --
-- would generate a url such as -- would generate a url such as
-- @http://www.example.com/static/thumb001.jpg?foo=5&bar=choc@ -- @http://www.example.com/static/thumb001.jpg?foo=5&bar=choc@
-- The StaticRoute constructor can be used when the URL cannot be -- The StaticRoute constructor can be used when the URL cannot be
-- statically generated at compile-time (e.g. when generating -- statically generated at compile-time (e.g. when generating
-- image galleries). -- image galleries).
data StaticRoute = StaticRoute [Text] [(Text, Text)] data Route Static = StaticRoute [Text] [(Text, Text)]
deriving (Eq, Show, Read) deriving (Eq, Show, Read)
type instance Route Static = StaticRoute
instance RenderRoute StaticRoute where
renderRoute (StaticRoute x y) = (x, y) renderRoute (StaticRoute x y) = (x, y)
instance Yesod master => YesodDispatch Static master where instance Yesod master => YesodDispatch Static master where
-- Need to append trailing slash to make relative links work -- Need to append trailing slash to make relative links work
yesodDispatch _ _ [] _ _ = Just $ yesodDispatch _ _ _ _ _ _ [] _ req =
\req -> return $ responseLBS status301 [("Location", rawPathInfo req `S.append` "/")] "" return $ responseLBS status301 [("Location", rawPathInfo req `S.append` "/")] ""
yesodDispatch (Static set) _ textPieces _ _ = Just $ yesodDispatch _ (Static set) _ _ _ _ textPieces _ req =
\req -> staticApp set req { pathInfo = textPieces } staticApp set req { pathInfo = textPieces }
notHidden :: Prelude.FilePath -> Bool notHidden :: Prelude.FilePath -> Bool
notHidden "tmp" = False notHidden "tmp" = False

View File

@ -13,7 +13,7 @@ homepage: http://www.yesodweb.com/
description: Static file serving subsite for Yesod Web Framework. description: Static file serving subsite for Yesod Web Framework.
extra-source-files: extra-source-files:
test/YesodStaticTest.hs test/YesodStaticTest.hs
tests.hs test/tests.hs
flag test flag test
description: Build for use with running tests description: Build for use with running tests