upgrade scaffold to 0.9

This commit is contained in:
Greg Weber 2011-08-01 10:30:22 -07:00
parent 9206a0554d
commit 15142f344f
8 changed files with 20 additions and 18 deletions

View File

@ -9,8 +9,8 @@ module Controller
import ~sitearg~ import ~sitearg~
import Settings import Settings
import Yesod.Helpers.Static import Yesod.Static
import Yesod.Helpers.Auth import Yesod.Auth
import Database.Persist.GenericSql import Database.Persist.GenericSql
import Data.ByteString (ByteString) import Data.ByteString (ByteString)
import Data.Dynamic (Dynamic, toDyn) import Data.Dynamic (Dynamic, toDyn)

View File

@ -1,4 +1,4 @@
{-# LANGUAGE QuasiQuotes, TypeFamilies, GeneralizedNewtypeDeriving, TemplateHaskell #-} {-# LANGUAGE QuasiQuotes, TypeFamilies, GeneralizedNewtypeDeriving, TemplateHaskell, GADTs #-}
module Model where module Model where
import Yesod import Yesod

View File

@ -47,9 +47,10 @@ executable ~project~
hs-source-dirs: ., config hs-source-dirs: ., config
build-depends: base >= 4 && < 5 build-depends: base >= 4 && < 5
, yesod >= 0.8 && < 0.9 , yesod >= 0.9 && < 0.10
, yesod-auth >= 0.4 && < 0.5 , yesod-auth
, yesod-static >= 0.1 && < 0.2 , yesod-static
, blaze-html
, yesod-form , yesod-form
, mime-mail , mime-mail
, clientsession , clientsession
@ -59,7 +60,7 @@ executable ~project~
, text , text
, persistent , persistent
, persistent-template , persistent-template
, persistent-~backendLower~ >= 0.5 && < 0.6 , persistent-~backendLower~ >= 0.6 && < 0.7
, template-haskell , template-haskell
, hamlet , hamlet
, hjsmin , hjsmin

View File

@ -1,7 +1,7 @@
{-# LANGUAGE QuasiQuotes, TemplateHaskell, TypeFamilies #-} {-# LANGUAGE QuasiQuotes, TemplateHaskell, TypeFamilies #-}
module StaticFiles where module StaticFiles where
import Yesod.Helpers.Static import Yesod.Static
-- | This generates easy references to files in the static directory at compile time. -- | This generates easy references to files in the static directory at compile time.
-- The upside to this is that you have compile-time verification that referenced files -- The upside to this is that you have compile-time verification that referenced files

View File

@ -9,7 +9,7 @@ module Controller
import ~sitearg~ import ~sitearg~
import Settings import Settings
import Yesod.Helpers.Static import Yesod.Static
import Data.ByteString (ByteString) import Data.ByteString (ByteString)
import Network.Wai (Application) import Network.Wai (Application)
import Data.Dynamic (Dynamic, toDyn) import Data.Dynamic (Dynamic, toDyn)

View File

@ -46,7 +46,7 @@ executable ~project~
hs-source-dirs: ., config hs-source-dirs: ., config
build-depends: base >= 4 && < 5 build-depends: base >= 4 && < 5
, yesod-core >= 0.8 && < 0.9 , yesod-core >= 0.9 && < 0.10
, yesod-static , yesod-static
, clientsession , clientsession
, wai-extra , wai-extra

View File

@ -14,7 +14,7 @@ module ~sitearg~
) where ) where
import Yesod.Core import Yesod.Core
import Yesod.Helpers.Static import Yesod.Static
import qualified Settings import qualified Settings
import System.Directory import System.Directory
import qualified Data.ByteString.Lazy as L import qualified Data.ByteString.Lazy as L

View File

@ -17,10 +17,10 @@ module ~sitearg~
import Yesod import Yesod
import Yesod.Form (defaultFormMessage) import Yesod.Form (defaultFormMessage)
import Yesod.Helpers.Static import Yesod.Static
import Yesod.Helpers.Auth import Yesod.Auth
import Yesod.Helpers.Auth.OpenId import Yesod.Auth.OpenId
import Yesod.Helpers.Auth.Email import Yesod.Auth.Email
import qualified Settings import qualified Settings
import System.Directory import System.Directory
import qualified Data.ByteString.Lazy as L import qualified Data.ByteString.Lazy as L
@ -36,6 +36,7 @@ import qualified Data.Text.Lazy.Encoding
import Text.Jasmine (minifym) import Text.Jasmine (minifym)
import qualified Data.Text as T import qualified Data.Text as T
import Web.ClientSession (getKey) import Web.ClientSession (getKey)
import Text.Blaze.Renderer.String (renderHtml)
-- | The site argument for your application. This can be a good place to -- | The site argument for your application. This can be a good place to
-- keep settings and values requiring initialization before your application -- keep settings and values requiring initialization before your application
@ -185,7 +186,7 @@ instance YesodAuthEmail ~sitearg~ where
, partHeaders = [] , partHeaders = []
} }
getVerifyKey = runDB . fmap (join . fmap emailVerkey) . get getVerifyKey = runDB . fmap (join . fmap emailVerkey) . get
setVerifyKey eid key = runDB $ update eid [EmailVerkey $ Just key] setVerifyKey eid key = runDB $ update eid [EmailVerkey =. Just key]
verifyAccount eid = runDB $ do verifyAccount eid = runDB $ do
me <- get eid me <- get eid
case me of case me of
@ -196,10 +197,10 @@ instance YesodAuthEmail ~sitearg~ where
Just uid -> return $ Just uid Just uid -> return $ Just uid
Nothing -> do Nothing -> do
uid <- insert $ User email Nothing uid <- insert $ User email Nothing
update eid [EmailUser $ Just uid, EmailVerkey Nothing] update eid [EmailUser =. Just uid, EmailVerkey =. Nothing]
return $ Just uid return $ Just uid
getPassword = runDB . fmap (join . fmap userPassword) . get getPassword = runDB . fmap (join . fmap userPassword) . get
setPassword uid pass = runDB $ update uid [UserPassword $ Just pass] setPassword uid pass = runDB $ update uid [UserPassword =. Just pass]
getEmailCreds email = runDB $ do getEmailCreds email = runDB $ do
me <- getBy $ UniqueEmail email me <- getBy $ UniqueEmail email
case me of case me of