Switch all HandlerT/WidgetT uses to HandlerFor/WidgetFor
This commit is contained in:
parent
c531f41565
commit
b64984495f
5 changed files with 11 additions and 12 deletions
|
@ -326,5 +326,5 @@ handler :: Handler a -> IO a
|
|||
handler h = getAppSettings >>= makeFoundation >>= flip unsafeHandler h
|
||||
|
||||
-- | Run DB queries
|
||||
db :: ReaderT SqlBackend (HandlerT App IO) a -> IO a
|
||||
db :: ReaderT SqlBackend (HandlerFor App) a -> IO a
|
||||
db = handler . runDB
|
||||
|
|
|
@ -135,12 +135,12 @@ type LocalMessageKeyHashid = KeyHashid LocalMessage
|
|||
-- http://www.yesodweb.com/book/scaffolding-and-the-site-template#scaffolding-and-the-site-template_foundation_and_application_modules
|
||||
--
|
||||
-- This function also generates the following type synonyms:
|
||||
-- type Handler = HandlerT App IO
|
||||
-- type Widget = WidgetT App IO ()
|
||||
-- type Handler = HandlerFor App
|
||||
-- type Widget = WidgetFor App ()
|
||||
mkYesodData "App" $(parseRoutesFile "config/routes")
|
||||
|
||||
-- | A convenient synonym for creating forms.
|
||||
type Form a = Html -> MForm (HandlerT App IO) (FormResult a, Widget)
|
||||
type Form a = Html -> MForm (HandlerFor App) (FormResult a, Widget)
|
||||
|
||||
type AppDB = YesodDB App
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ import Data.Traversable
|
|||
import Formatting (sformat, stext, int, (%))
|
||||
import Yesod.Core
|
||||
import Yesod.Core.Handler
|
||||
import Yesod.Core.Widget (WidgetT)
|
||||
|
||||
import qualified Data.Text as T (null, pack)
|
||||
import qualified Data.Text.Read as TR (decimal)
|
||||
|
@ -106,7 +105,7 @@ getPageAndNavTop
|
|||
-> m (Int, Int, f i, NavModel)
|
||||
getPageAndNavTop select = paginateTop (paginateSettings select) navSettings
|
||||
|
||||
navWidget :: NavModel -> WidgetT site IO ()
|
||||
navWidget :: NavModel -> WidgetFor site ()
|
||||
navWidget nm = do
|
||||
route <-
|
||||
fromMaybe (error "Pagination in invalid response content") <$>
|
||||
|
|
|
@ -40,12 +40,12 @@ import Vervis.Settings (widgetFile)
|
|||
import Vervis.Style
|
||||
import Vervis.Time (showDate)
|
||||
|
||||
breadcrumbsW :: YesodBreadcrumbs site => WidgetT site IO ()
|
||||
breadcrumbsW :: YesodBreadcrumbs site => WidgetFor site ()
|
||||
breadcrumbsW = do
|
||||
(current, bcs) <- handlerToWidget breadcrumbs
|
||||
$(widgetFile "widget/breadcrumbs")
|
||||
|
||||
revisionW :: WidgetT site IO ()
|
||||
revisionW :: WidgetFor site ()
|
||||
revisionW =
|
||||
let cgTimeFmt = showDate . cgTime
|
||||
mrev = $darcsRevision
|
||||
|
@ -54,7 +54,7 @@ revisionW =
|
|||
changes = $darcsTotalPatches :: Int
|
||||
in $(widgetFile "widget/revision")
|
||||
|
||||
avatarW :: Bool -> Text -> WidgetT site IO ()
|
||||
avatarW :: Bool -> Text -> WidgetFor site ()
|
||||
avatarW secure email = do
|
||||
murl <- getAvatarUrl secure email
|
||||
[whamlet|
|
||||
|
@ -65,7 +65,7 @@ avatarW secure email = do
|
|||
<p>INVALID EMAIL
|
||||
|]
|
||||
|
||||
buttonW :: StdMethod -> Text -> Route site -> WidgetT site IO ()
|
||||
buttonW :: StdMethod -> Text -> Route site -> WidgetFor site ()
|
||||
buttonW method content route = do
|
||||
let tokenKey = defaultCsrfParamName
|
||||
mtoken <- reqToken <$> getRequest
|
||||
|
|
|
@ -34,7 +34,7 @@ import Data.Default.Class
|
|||
import Data.Text (Text)
|
||||
import Text.Blaze (ToMarkup)
|
||||
import Yesod.Core
|
||||
import Yesod.Core.Widget (WidgetT, whamlet)
|
||||
import Yesod.Core.Widget
|
||||
|
||||
import qualified Data.Text as T (pack)
|
||||
import qualified Formatting as F
|
||||
|
@ -76,7 +76,7 @@ pageNavWidget
|
|||
=> NavModel
|
||||
-> NavWidgetSettings
|
||||
-> (Int -> (Route site, t))
|
||||
-> WidgetT site IO ()
|
||||
-> WidgetFor site ()
|
||||
pageNavWidget nm nws mklink =
|
||||
let link n label =
|
||||
let (route, suffix) = mklink n
|
||||
|
|
Loading…
Reference in a new issue