Some various fixes

This commit is contained in:
Michael Snoyman 2011-01-31 13:27:06 +02:00
parent 49634531f1
commit 6d2f366094
2 changed files with 10 additions and 8 deletions

View File

@ -27,6 +27,7 @@ import Data.Char (isSpace)
import Data.Default import Data.Default
import Text.Hamlet (hamlet) import Text.Hamlet (hamlet)
import Text.Julius (julius) import Text.Julius (julius)
import Control.Monad.Trans.Class (lift)
#if __GLASGOW_HASKELL__ >= 700 #if __GLASGOW_HASKELL__ >= 700
#define HAMLET hamlet #define HAMLET hamlet
@ -96,10 +97,10 @@ jqueryDayFieldProfile jds = FieldProfile
addJulius [JULIUS| addJulius [JULIUS|
$(function(){$("##{theId}").datepicker({ $(function(){$("##{theId}").datepicker({
dateFormat:'yy-mm-dd', dateFormat:'yy-mm-dd',
changeMonth:%jsBool.jdsChangeMonth.jds%, changeMonth:#{jsBool $ jdsChangeMonth jds},
changeYear:%jsBool.jdsChangeYear.jds%, changeYear:#{jsBool $ jdsChangeYear jds},
numberOfMonths:%mos.jdsNumberOfMonths.jds%, numberOfMonths:#{mos $ jdsNumberOfMonths jds},
yearRange:"%jdsYearRange.jds%" yearRange:"#{jdsYearRange jds}"
})}); })});
|] |]
} }
@ -196,18 +197,18 @@ jqueryAutocompleteFieldProfile src = FieldProfile
addScript' urlJqueryUiJs addScript' urlJqueryUiJs
addStylesheet' urlJqueryUiCss addStylesheet' urlJqueryUiCss
addJulius [JULIUS| 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' :: (y -> Either (Route y) String) -> GWidget sub y ()
addScript' f = do addScript' f = do
y <- liftHandler getYesod y <- lift getYesod
addScriptEither $ f y addScriptEither $ f y
addStylesheet' :: (y -> Either (Route y) String) -> GWidget sub y () addStylesheet' :: (y -> Either (Route y) String) -> GWidget sub y ()
addStylesheet' f = do addStylesheet' f = do
y <- liftHandler getYesod y <- lift getYesod
addStylesheetEither $ f y addStylesheetEither $ f y
readMay :: Read a => String -> Maybe a readMay :: Read a => String -> Maybe a

View File

@ -17,6 +17,7 @@ import Text.Hamlet (Html, hamlet)
import Text.Julius (julius) import Text.Julius (julius)
import Text.Blaze.Renderer.String (renderHtml) import Text.Blaze.Renderer.String (renderHtml)
import Text.Blaze (preEscapedString) import Text.Blaze (preEscapedString)
import Control.Monad.Trans.Class (lift)
class YesodNic a where class YesodNic a where
-- | NIC Editor Javascript file. -- | 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' :: (y -> Either (Route y) String) -> GWidget sub y ()
addScript' f = do addScript' f = do
y <- liftHandler getYesod y <- lift getYesod
addScriptEither $ f y addScriptEither $ f y