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 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

View File

@ -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