From 6d2f3660946c8854041fca5988efdd77ea70a980 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Mon, 31 Jan 2011 13:27:06 +0200 Subject: [PATCH] Some various fixes --- Yesod/Form/Jquery.hs | 15 ++++++++------- Yesod/Form/Nic.hs | 3 ++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Yesod/Form/Jquery.hs b/Yesod/Form/Jquery.hs index a44414b6..3ce6dbc4 100644 --- a/Yesod/Form/Jquery.hs +++ b/Yesod/Form/Jquery.hs @@ -27,6 +27,7 @@ import Data.Char (isSpace) import Data.Default import Text.Hamlet (hamlet) import Text.Julius (julius) +import Control.Monad.Trans.Class (lift) #if __GLASGOW_HASKELL__ >= 700 #define HAMLET hamlet @@ -96,10 +97,10 @@ jqueryDayFieldProfile jds = FieldProfile addJulius [JULIUS| $(function(){$("##{theId}").datepicker({ dateFormat:'yy-mm-dd', - changeMonth:%jsBool.jdsChangeMonth.jds%, - changeYear:%jsBool.jdsChangeYear.jds%, - numberOfMonths:%mos.jdsNumberOfMonths.jds%, - yearRange:"%jdsYearRange.jds%" + changeMonth:#{jsBool $ jdsChangeMonth jds}, + changeYear:#{jsBool $ jdsChangeYear jds}, + numberOfMonths:#{mos $ jdsNumberOfMonths jds}, + yearRange:"#{jdsYearRange jds}" })}); |] } @@ -196,18 +197,18 @@ jqueryAutocompleteFieldProfile src = FieldProfile addScript' urlJqueryUiJs addStylesheet' urlJqueryUiCss addJulius [JULIUS| -$(function(){$("##{theId}").autocomplete({source:"@src@",minLength:2})}); +$(function(){$("##{theId}").autocomplete({source:"@{src}",minLength:2})}); |] } addScript' :: (y -> Either (Route y) String) -> GWidget sub y () addScript' f = do - y <- liftHandler getYesod + y <- lift getYesod addScriptEither $ f y addStylesheet' :: (y -> Either (Route y) String) -> GWidget sub y () addStylesheet' f = do - y <- liftHandler getYesod + y <- lift getYesod addStylesheetEither $ f y readMay :: Read a => String -> Maybe a diff --git a/Yesod/Form/Nic.hs b/Yesod/Form/Nic.hs index f3dea3e6..5c049145 100644 --- a/Yesod/Form/Nic.hs +++ b/Yesod/Form/Nic.hs @@ -17,6 +17,7 @@ import Text.Hamlet (Html, hamlet) import Text.Julius (julius) import Text.Blaze.Renderer.String (renderHtml) import Text.Blaze (preEscapedString) +import Control.Monad.Trans.Class (lift) class YesodNic a where -- | NIC Editor Javascript file. @@ -58,5 +59,5 @@ bkLib.onDomLoaded(function(){new nicEditor({fullPanel:true}).panelInstance("#{th addScript' :: (y -> Either (Route y) String) -> GWidget sub y () addScript' f = do - y <- liftHandler getYesod + y <- lift getYesod addScriptEither $ f y