diff options
author | androidbuilder <androidbuilder@example.com> | 2015-08-02 19:48:36 +0000 |
---|---|---|
committer | androidbuilder <androidbuilder@example.com> | 2015-08-02 19:48:36 +0000 |
commit | d03dd472b7f987695489f01d52cedb8b16e5b6c1 (patch) | |
tree | c5f5d0bd8a6a68476fc4cc6616170e8545d51791 /standalone/no-th/haskell-patches/yesod-form_spliced-TH.patch | |
parent | f37922856e7ac2ad535f8da11dc291f485e22b98 (diff) |
reverted updates to new lib versions that broke android build
I ran into several evilsplicer problems with the new lib versions, most notably including a problem with encoding of embedded binary files
Diffstat (limited to 'standalone/no-th/haskell-patches/yesod-form_spliced-TH.patch')
-rw-r--r-- | standalone/no-th/haskell-patches/yesod-form_spliced-TH.patch | 676 |
1 files changed, 346 insertions, 330 deletions
diff --git a/standalone/no-th/haskell-patches/yesod-form_spliced-TH.patch b/standalone/no-th/haskell-patches/yesod-form_spliced-TH.patch index b9a84b1ad..84314a8d9 100644 --- a/standalone/no-th/haskell-patches/yesod-form_spliced-TH.patch +++ b/standalone/no-th/haskell-patches/yesod-form_spliced-TH.patch @@ -1,27 +1,22 @@ -From 4cf9a045569ea0b51b4ee11df2dadbde330f7813 Mon Sep 17 00:00:00 2001 +From 1b24ece1a40c9365f719472ca6e342c8c4065c25 Mon Sep 17 00:00:00 2001 From: dummy <dummy@example.com> -Date: Fri, 3 Jul 2015 01:06:34 +0000 +Date: Thu, 16 Oct 2014 02:31:20 +0000 Subject: [PATCH] hack TH -1. EvilSplicer -2. Add imports -3. Fix some syntax errors in spliced code -4. Remove some persistent stuff that doesn't build. --- - Yesod/Form/Bootstrap3.hs | 189 +++++++++-- - Yesod/Form/Fields.hs | 811 ++++++++++++++++++++++++++++++++++++----------- - Yesod/Form/Functions.hs | 255 ++++++++++++--- - Yesod/Form/Jquery.hs | 124 ++++++-- + Yesod/Form/Bootstrap3.hs | 186 +++++++++-- + Yesod/Form/Fields.hs | 816 +++++++++++++++++++++++++++++++++++------------ + Yesod/Form/Functions.hs | 257 ++++++++++++--- + Yesod/Form/Jquery.hs | 134 ++++++-- Yesod/Form/MassInput.hs | 226 ++++++++++--- - Yesod/Form/Nic.hs | 60 +++- - yesod-form.cabal | 2 +- - 7 files changed, 1311 insertions(+), 356 deletions(-) + Yesod/Form/Nic.hs | 67 +++- + 6 files changed, 1322 insertions(+), 364 deletions(-) diff --git a/Yesod/Form/Bootstrap3.hs b/Yesod/Form/Bootstrap3.hs -index 8377a68..fa8b7d4 100644 +index 84e85fc..1954fb4 100644 --- a/Yesod/Form/Bootstrap3.hs +++ b/Yesod/Form/Bootstrap3.hs -@@ -35,6 +35,9 @@ import Data.String (IsString(..)) +@@ -26,6 +26,9 @@ import Data.String (IsString(..)) import Yesod.Core import qualified Data.Text as T @@ -31,7 +26,7 @@ index 8377a68..fa8b7d4 100644 import Yesod.Form.Types import Yesod.Form.Functions -@@ -155,44 +158,144 @@ renderBootstrap3 formLayout aform fragment = do +@@ -152,44 +155,144 @@ renderBootstrap3 formLayout aform fragment = do let views = views' [] has (Just _) = True has Nothing = False @@ -64,22 +59,22 @@ index 8377a68..fa8b7d4 100644 - |] + widget = do { (asWidgetT . toWidget) (toHtml fragment); + Data.Foldable.mapM_ -+ (\ view_a2d4p ++ (\ view_as0a + -> do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . T.pack) + "<div class=\"form-group "); + Text.Hamlet.condH -+ [(fvRequired view_a2d4p, ++ [(fvRequired view_as0a, + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . T.pack) "required "))] + Nothing; + Text.Hamlet.condH -+ [(not (fvRequired view_a2d4p), ++ [(not (fvRequired view_as0a), + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . T.pack) "optional "))] + Nothing; + Text.Hamlet.condH -+ [(has (fvErrors view_a2d4p), ++ [(has (fvErrors view_as0a), + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . T.pack) "has-error"))] + Nothing; @@ -88,66 +83,66 @@ index 8377a68..fa8b7d4 100644 + case formLayout of { + ; BootstrapBasicForm + -> do { Text.Hamlet.condH -+ [((/=) (fvId view_a2d4p) bootstrapSubmitId, ++ [((/=) (fvId view_as0a) bootstrapSubmitId, + do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . T.pack) + "<label for=\""); -+ (asWidgetT . toWidget) (toHtml (fvId view_a2d4p)); ++ (asWidgetT . toWidget) (toHtml (fvId view_as0a)); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . T.pack) "\">"); -+ (asWidgetT . toWidget) (toHtml (fvLabel view_a2d4p)); ++ (asWidgetT . toWidget) (toHtml (fvLabel view_as0a)); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . T.pack) + "</label>") })] + Nothing; -+ (asWidgetT . toWidget) (fvInput view_a2d4p); -+ (asWidgetT . toWidget) (helpWidget view_a2d4p) } ++ (asWidgetT . toWidget) (fvInput view_as0a); ++ (asWidgetT . toWidget) (helpWidget view_as0a) } + ; BootstrapInlineForm + -> do { Text.Hamlet.condH -+ [((/=) (fvId view_a2d4p) bootstrapSubmitId, ++ [((/=) (fvId view_as0a) bootstrapSubmitId, + do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . T.pack) + "<label class=\"sr-only\" for=\""); -+ (asWidgetT . toWidget) (toHtml (fvId view_a2d4p)); ++ (asWidgetT . toWidget) (toHtml (fvId view_as0a)); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . T.pack) "\">"); -+ (asWidgetT . toWidget) (toHtml (fvLabel view_a2d4p)); ++ (asWidgetT . toWidget) (toHtml (fvLabel view_as0a)); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . T.pack) + "</label>") })] + Nothing; -+ (asWidgetT . toWidget) (fvInput view_a2d4p); -+ (asWidgetT . toWidget) (helpWidget view_a2d4p) } -+ ; BootstrapHorizontalForm labelOffset_a2d4q -+ labelSize_a2d4r -+ inputOffset_a2d4s -+ inputSize_a2d4t ++ (asWidgetT . toWidget) (fvInput view_as0a); ++ (asWidgetT . toWidget) (helpWidget view_as0a) } ++ ; BootstrapHorizontalForm labelOffset_as0b ++ labelSize_as0c ++ inputOffset_as0d ++ inputSize_as0e + -> Text.Hamlet.condH -+ [((/=) (fvId view_a2d4p) bootstrapSubmitId, ++ [((/=) (fvId view_as0a) bootstrapSubmitId, + do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . T.pack) + "<label class=\"control-label "); -+ (asWidgetT . toWidget) (toHtml (toOffset labelOffset_a2d4q)); ++ (asWidgetT . toWidget) (toHtml (toOffset labelOffset_as0b)); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . T.pack) " "); -+ (asWidgetT . toWidget) (toHtml (toColumn labelSize_a2d4r)); ++ (asWidgetT . toWidget) (toHtml (toColumn labelSize_as0c)); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . T.pack) "\" for=\""); -+ (asWidgetT . toWidget) (toHtml (fvId view_a2d4p)); ++ (asWidgetT . toWidget) (toHtml (fvId view_as0a)); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . T.pack) "\">"); -+ (asWidgetT . toWidget) (toHtml (fvLabel view_a2d4p)); ++ (asWidgetT . toWidget) (toHtml (fvLabel view_as0a)); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . T.pack) + "</label><div class=\""); -+ (asWidgetT . toWidget) (toHtml (toOffset inputOffset_a2d4s)); ++ (asWidgetT . toWidget) (toHtml (toOffset inputOffset_as0d)); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . T.pack) " "); -+ (asWidgetT . toWidget) (toHtml (toColumn inputSize_a2d4t)); ++ (asWidgetT . toWidget) (toHtml (toColumn inputSize_as0e)); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . T.pack) "\">"); -+ (asWidgetT . toWidget) (fvInput view_a2d4p); -+ (asWidgetT . toWidget) (helpWidget view_a2d4p); ++ (asWidgetT . toWidget) (fvInput view_as0a); ++ (asWidgetT . toWidget) (helpWidget view_as0a); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . T.pack) "</div>") })] + (Just @@ -158,15 +153,15 @@ index 8377a68..fa8b7d4 100644 + (toHtml + (toOffset + (addGO -+ inputOffset_a2d4s -+ (addGO labelOffset_a2d4q labelSize_a2d4r)))); ++ inputOffset_as0d ++ (addGO labelOffset_as0b labelSize_as0c)))); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . T.pack) " "); -+ (asWidgetT . toWidget) (toHtml (toColumn inputSize_a2d4t)); ++ (asWidgetT . toWidget) (toHtml (toColumn inputSize_as0e)); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . T.pack) "\">"); -+ (asWidgetT . toWidget) (fvInput view_a2d4p); -+ (asWidgetT . toWidget) (helpWidget view_a2d4p); ++ (asWidgetT . toWidget) (fvInput view_as0a); ++ (asWidgetT . toWidget) (helpWidget view_as0a); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . T.pack) + "</div>") })) }; @@ -187,21 +182,21 @@ index 8377a68..fa8b7d4 100644 -|] +helpWidget view = do { Text.Hamlet.maybeH + (fvTooltip view) -+ (\ tt_a2d5x ++ (\ tt_as0k + -> do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . T.pack) + "<span class=\"help-block\">"); -+ (asWidgetT . toWidget) (toHtml tt_a2d5x); ++ (asWidgetT . toWidget) (toHtml tt_as0k); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . T.pack) "</span>") }) + Nothing; + Text.Hamlet.maybeH + (fvErrors view) -+ (\ err_a2d5y ++ (\ err_as0l + -> do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . T.pack) + "<span class=\"help-block\">"); -+ (asWidgetT . toWidget) (toHtml err_a2d5y); ++ (asWidgetT . toWidget) (toHtml err_as0l); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . T.pack) "</span>") }) + Nothing } @@ -209,7 +204,7 @@ index 8377a68..fa8b7d4 100644 -- | How the 'bootstrapSubmit' button should be rendered. -@@ -247,7 +350,23 @@ mbootstrapSubmit +@@ -244,7 +347,22 @@ mbootstrapSubmit => BootstrapSubmit msg -> MForm m (FormResult (), FieldView site) mbootstrapSubmit (BootstrapSubmit msg classes attrs) = let res = FormSuccess () @@ -226,26 +221,40 @@ index 8377a68..fa8b7d4 100644 + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . T.pack) ">"); + ((liftM (toHtml .) getMessageRender) -+ >>= -+ (\ urender_a2d6f -> (asWidgetT . toWidget) (urender_a2d6f msg))); ++ >>= (\ urender_as0w -> (asWidgetT . toWidget) (urender_as0w msg))); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . T.pack) "</button>") } + fv = FieldView { fvLabel = "" , fvTooltip = Nothing , fvId = bootstrapSubmitId -@@ -314,4 +433,4 @@ bootstrapSubmitId = "b:ootstrap___unique__:::::::::::::::::submit-id" - -- > <$> areq textField nameSettings Nothing - -- > where nameSettings = withAutofocus $ - -- > withPlaceholder "First name" $ ---- > (bfs ("Name" :: Text)) -\ No newline at end of file -+-- > (bfs ("Name" :: Text)) diff --git a/Yesod/Form/Fields.hs b/Yesod/Form/Fields.hs -index 5fe123e..42fd7d6 100644 +index c6091a9..9e6bd4e 100644 --- a/Yesod/Form/Fields.hs +++ b/Yesod/Form/Fields.hs -@@ -52,8 +52,6 @@ module Yesod.Form.Fields +@@ -1,4 +1,3 @@ +-{-# LANGUAGE QuasiQuotes #-} + {-# LANGUAGE TypeFamilies #-} + {-# LANGUAGE OverloadedStrings #-} + {-# LANGUAGE GeneralizedNewtypeDeriving #-} +@@ -18,9 +17,6 @@ module Yesod.Form.Fields + , timeField + , htmlField + , emailField +- , multiEmailField +- , searchField +- , AutoFocus + , urlField + , doubleField + , parseDate +@@ -37,15 +33,11 @@ module Yesod.Form.Fields + , selectFieldList + , radioField + , radioFieldList +- , checkboxesFieldList +- , checkboxesField + , multiSelectField + , multiSelectFieldList , Option (..) , OptionList (..) , mkOptionList @@ -254,7 +263,7 @@ index 5fe123e..42fd7d6 100644 , optionsPairs , optionsEnum ) where -@@ -80,6 +78,15 @@ import Control.Monad (when, unless) +@@ -72,6 +64,15 @@ import Control.Monad (when, unless) import Data.Either (partitionEithers) import Data.Maybe (listToMaybe, fromMaybe) @@ -270,7 +279,14 @@ index 5fe123e..42fd7d6 100644 import qualified Blaze.ByteString.Builder.Html.Utf8 as B import Blaze.ByteString.Builder (writeByteString, toLazyByteString) import Blaze.ByteString.Builder.Internal.Write (fromWriteList) -@@ -102,8 +109,6 @@ import Control.Applicative ((<$>), (<|>)) +@@ -91,15 +92,12 @@ import qualified Data.Text as T (drop, dropWhile) + import qualified Data.Text.Read + + import qualified Data.Map as Map +-import Yesod.Persist (selectList, runDB, Filter, SelectOpt, Key, YesodPersist, PersistEntity, PersistQuery) + import Control.Arrow ((&&&)) + + import Control.Applicative ((<$>), (<|>)) import Data.Attoparsec.Text (Parser, char, string, digit, skipSpace, endOfInput, parseOnly) @@ -279,7 +295,7 @@ index 5fe123e..42fd7d6 100644 defaultFormMessage :: FormMessage -> Text defaultFormMessage = englishFormMessage -@@ -115,10 +120,25 @@ intField = Field +@@ -111,10 +109,25 @@ intField = Field Right (a, "") -> Right a _ -> Left $ MsgInvalidInteger s @@ -287,7 +303,7 @@ index 5fe123e..42fd7d6 100644 -$newline never -<input id="#{theId}" name="#{name}" *{attrs} type="number" step=1 :isReq:required="" value="#{showVal val}"> -|] -+ , fieldView = \theId name attrs val isReq -> toWidget $ \ _render_a2nCq ++ , fieldView = \theId name attrs val isReq -> toWidget $ \ _render_aJJh + -> do { id + ((Text.Blaze.Internal.preEscapedText . pack) "<input id=\""); + id (toHtml theId); @@ -309,7 +325,7 @@ index 5fe123e..42fd7d6 100644 , fieldEnctype = UrlEncoded } where -@@ -133,10 +153,25 @@ doubleField = Field +@@ -128,10 +141,25 @@ doubleField = Field Right (a, "") -> Right a _ -> Left $ MsgInvalidNumber s @@ -317,7 +333,7 @@ index 5fe123e..42fd7d6 100644 -$newline never -<input id="#{theId}" name="#{name}" *{attrs} type="number" step=any :isReq:required="" value="#{showVal val}"> -|] -+ , fieldView = \theId name attrs val isReq -> toWidget $ \ _render_a2nCV ++ , fieldView = \theId name attrs val isReq -> toWidget $ \ _render_aJJu + -> do { id + ((Text.Blaze.Internal.preEscapedText . pack) "<input id=\""); + id (toHtml theId); @@ -339,7 +355,7 @@ index 5fe123e..42fd7d6 100644 , fieldEnctype = UrlEncoded } where showVal = either id (pack . show) -@@ -147,10 +182,24 @@ $newline never +@@ -139,10 +167,24 @@ $newline never dayField :: Monad m => RenderMessage (HandlerSite m) FormMessage => Field m Day dayField = Field { fieldParse = parseHelper $ parseDate . unpack @@ -347,7 +363,7 @@ index 5fe123e..42fd7d6 100644 -$newline never -<input id="#{theId}" name="#{name}" *{attrs} type="date" :isReq:required="" value="#{showVal val}"> -|] -+ , fieldView = \theId name attrs val isReq -> toWidget $ \ _render_a2nDh ++ , fieldView = \theId name attrs val isReq -> toWidget $ \ _render_aJJF + -> do { id + ((Text.Blaze.Internal.preEscapedText . pack) "<input id=\""); + id (toHtml theId); @@ -368,22 +384,20 @@ index 5fe123e..42fd7d6 100644 , fieldEnctype = UrlEncoded } where showVal = either id (pack . show) -@@ -179,10 +228,25 @@ timeFieldTypeText = timeFieldOfType "text" - timeFieldOfType :: Monad m => RenderMessage (HandlerSite m) FormMessage => Text -> Field m TimeOfDay - timeFieldOfType inputType = Field +@@ -150,10 +192,23 @@ $newline never + timeField :: Monad m => RenderMessage (HandlerSite m) FormMessage => Field m TimeOfDay + timeField = Field { fieldParse = parseHelper parseTime - , fieldView = \theId name attrs val isReq -> toWidget [hamlet| -$newline never --<input id="#{theId}" name="#{name}" *{attrs} type="#{inputType}" :isReq:required="" value="#{showVal val}"> +-<input id="#{theId}" name="#{name}" *{attrs} :isReq:required="" value="#{showVal val}"> -|] -+ , fieldView = \theId name attrs val isReq -> toWidget $ \ _render_a2nDN ++ , fieldView = \theId name attrs val isReq -> toWidget $ \ _render_aJJT + -> do { id + ((Text.Blaze.Internal.preEscapedText . pack) "<input id=\""); + id (toHtml theId); + id ((Text.Blaze.Internal.preEscapedText . pack) "\" name=\""); + id (toHtml name); -+ id ((Text.Blaze.Internal.preEscapedText . pack) "\" type=\""); -+ id (toHtml inputType); + id ((Text.Blaze.Internal.preEscapedText . pack) "\""); + condH + [(isReq, @@ -398,7 +412,7 @@ index 5fe123e..42fd7d6 100644 , fieldEnctype = UrlEncoded } where -@@ -196,10 +260,23 @@ $newline never +@@ -166,10 +221,23 @@ $newline never htmlField :: Monad m => RenderMessage (HandlerSite m) FormMessage => Field m Html htmlField = Field { fieldParse = parseHelper $ Right . preEscapedText . sanitizeBalance @@ -406,7 +420,7 @@ index 5fe123e..42fd7d6 100644 -$newline never -<textarea :isReq:required="" id="#{theId}" name="#{name}" *{attrs}>#{showVal val} -|] -+ , fieldView = \theId name attrs val isReq -> toWidget $ \ _render_a2nEc ++ , fieldView = \theId name attrs val isReq -> toWidget $ \ _render_aJK4 + -> do { id + ((Text.Blaze.Internal.preEscapedText . pack) "<textarea"); + condH @@ -426,25 +440,21 @@ index 5fe123e..42fd7d6 100644 , fieldEnctype = UrlEncoded } where showVal = either id (pack . renderHtml) -@@ -231,10 +308,22 @@ instance ToHtml Textarea where +@@ -197,10 +265,18 @@ instance ToHtml Textarea where textareaField :: Monad m => RenderMessage (HandlerSite m) FormMessage => Field m Textarea textareaField = Field { fieldParse = parseHelper $ Right . Textarea -- , fieldView = \theId name attrs val isReq -> toWidget [hamlet| +- , fieldView = \theId name attrs val _isReq -> toWidget [hamlet| -$newline never --<textarea id="#{theId}" name="#{name}" :isReq:required="" *{attrs}>#{either id unTextarea val} +-<textarea id="#{theId}" name="#{name}" *{attrs}>#{either id unTextarea val} -|] -+ , fieldView = \theId name attrs val isReq -> toWidget $ \ _render_a2nEL ++ , fieldView = \theId name attrs val _isReq -> toWidget $ \ _render_aJKe + -> do { id + ((Text.Blaze.Internal.preEscapedText . pack) "<textarea id=\""); + id (toHtml theId); + id ((Text.Blaze.Internal.preEscapedText . pack) "\" name=\""); + id (toHtml name); + id ((Text.Blaze.Internal.preEscapedText . pack) "\""); -+ condH -+ [(isReq, -+ id ((Text.Blaze.Internal.preEscapedText . pack) " required=\"\""))] -+ Nothing; + id ((attrsToHtml . toAttributes) attrs); + id ((Text.Blaze.Internal.preEscapedText . pack) ">"); + id (toHtml (either id unTextarea val)); @@ -453,7 +463,7 @@ index 5fe123e..42fd7d6 100644 , fieldEnctype = UrlEncoded } -@@ -243,10 +332,19 @@ hiddenField :: (Monad m, PathPiece p, RenderMessage (HandlerSite m) FormMessage) +@@ -208,10 +284,19 @@ hiddenField :: (Monad m, PathPiece p, RenderMessage (HandlerSite m) FormMessage) => Field m p hiddenField = Field { fieldParse = parseHelper $ maybe (Left MsgValueRequired) Right . fromPathPiece @@ -461,7 +471,7 @@ index 5fe123e..42fd7d6 100644 -$newline never -<input type="hidden" id="#{theId}" name="#{name}" *{attrs} value="#{either id toPathPiece val}"> -|] -+ , fieldView = \theId name attrs val _isReq -> toWidget $ \ _render_a2nFl ++ , fieldView = \theId name attrs val _isReq -> toWidget $ \ _render_aJKo + -> do { id + ((Text.Blaze.Internal.preEscapedText . pack) + "<input type=\"hidden\" id=\""); @@ -477,7 +487,7 @@ index 5fe123e..42fd7d6 100644 , fieldEnctype = UrlEncoded } -@@ -255,20 +353,53 @@ textField :: Monad m => RenderMessage (HandlerSite m) FormMessage => Field m Tex +@@ -219,20 +304,53 @@ textField :: Monad m => RenderMessage (HandlerSite m) FormMessage => Field m Tex textField = Field { fieldParse = parseHelper $ Right , fieldView = \theId name attrs val isReq -> @@ -509,7 +519,7 @@ index 5fe123e..42fd7d6 100644 + , fieldEnctype = UrlEncoded } - -- | Creates an input with @type="password"@. + passwordField :: Monad m => RenderMessage (HandlerSite m) FormMessage => Field m Text passwordField = Field { fieldParse = parseHelper $ Right @@ -517,7 +527,7 @@ index 5fe123e..42fd7d6 100644 -$newline never -<input id="#{theId}" name="#{name}" *{attrs} type="password" :isReq:required="" value="#{either id id val}"> -|] -+ , fieldView = \theId name attrs val isReq -> toWidget $ \ _render_a2nG7 ++ , fieldView = \theId name attrs val isReq -> toWidget $ \ _render_aJKH + -> do { id + ((Text.Blaze.Internal.preEscapedText . pack) "<input id=\""); + id (toHtml theId); @@ -539,7 +549,7 @@ index 5fe123e..42fd7d6 100644 , fieldEnctype = UrlEncoded } -@@ -342,10 +473,24 @@ emailField = Field +@@ -304,10 +422,24 @@ emailField = Field case Email.canonicalizeEmail $ encodeUtf8 s of Just e -> Right $ decodeUtf8With lenientDecode e Nothing -> Left $ MsgInvalidEmail s @@ -547,7 +557,7 @@ index 5fe123e..42fd7d6 100644 -$newline never -<input id="#{theId}" name="#{name}" *{attrs} type="email" :isReq:required="" value="#{either id id val}"> -|] -+ , fieldView = \theId name attrs val isReq -> toWidget $ \ _render_a2nKu ++ , fieldView = \theId name attrs val isReq -> toWidget $ \ _render_aJLq + -> do { id + ((Text.Blaze.Internal.preEscapedText . pack) "<input id=\""); + id (toHtml theId); @@ -568,7 +578,7 @@ index 5fe123e..42fd7d6 100644 , fieldEnctype = UrlEncoded } -@@ -360,10 +505,25 @@ multiEmailField = Field +@@ -322,10 +454,25 @@ multiEmailField = Field in case partitionEithers addrs of ([], good) -> Right good (bad, _) -> Left $ MsgInvalidEmail $ cat bad @@ -576,7 +586,7 @@ index 5fe123e..42fd7d6 100644 -$newline never -<input id="#{theId}" name="#{name}" *{attrs} type="email" multiple :isReq:required="" value="#{either id cat val}"> -|] -+ , fieldView = \theId name attrs val isReq -> toWidget $ \ _render_a2nL5 ++ , fieldView = \theId name attrs val isReq -> toWidget $ \ _render_aJMd + -> do { id + ((Text.Blaze.Internal.preEscapedText . pack) "<input id=\""); + id (toHtml theId); @@ -598,7 +608,7 @@ index 5fe123e..42fd7d6 100644 , fieldEnctype = UrlEncoded } where -@@ -380,20 +540,74 @@ searchField :: Monad m => RenderMessage (HandlerSite m) FormMessage => AutoFocus +@@ -341,20 +488,75 @@ searchField :: Monad m => RenderMessage (HandlerSite m) FormMessage => AutoFocus searchField autoFocus = Field { fieldParse = parseHelper Right , fieldView = \theId name attrs val isReq -> do @@ -651,31 +661,32 @@ index 5fe123e..42fd7d6 100644 + ((Text.Blaze.Internal.preEscapedText . pack) + "').focus();}</script>") } + -+ toWidget $ \ _render_a2nMA -+ -> (Text.Css.CssNoWhitespace . (foldr ($) [])) ++ toWidget $ \ _render_aJMx ++ -> (Text.Css.CssNoWhitespace ++ . (foldr ($) [])) + [((++) + $ (map + Text.Css.TopBlock + (((Text.Css.Block + {Text.Css.blockSelector = Data.Monoid.mconcat -+ [(Text.Css.fromText -+ . Text.Css.pack) -+ "#", -+ toCss theId], ++ [(Text.Css.fromText ++ . Text.Css.pack) ++ "#", ++ toCss theId], + Text.Css.blockAttrs = (Prelude.concat -+ $ ([Text.Css.Attr -+ (Data.Monoid.mconcat -+ [(Text.Css.fromText -+ . Text.Css.pack) -+ "-webkit-appearance"]) -+ (Data.Monoid.mconcat -+ [(Text.Css.fromText -+ . Text.Css.pack) -+ "textfield"])] -+ : -+ (map -+ Text.Css.mixinAttrs -+ []))), ++ $ ([Text.Css.Attr ++ (Data.Monoid.mconcat ++ [(Text.Css.fromText ++ . Text.Css.pack) ++ "-webkit-appearance"]) ++ (Data.Monoid.mconcat ++ [(Text.Css.fromText ++ . Text.Css.pack) ++ "textfield"])] ++ : ++ (map ++ Text.Css.mixinAttrs ++ []))), + Text.Css.blockBlocks = (), + Text.Css.blockMixins = ()} :) + . ((foldr (.) id []) @@ -684,8 +695,8 @@ index 5fe123e..42fd7d6 100644 + , fieldEnctype = UrlEncoded } - -- | Creates an input with @type="url"@, validating the URL according to RFC3986. -@@ -404,7 +618,28 @@ urlField = Field + +@@ -365,7 +567,28 @@ urlField = Field Nothing -> Left $ MsgInvalidUrl s Just _ -> Right s , fieldView = \theId name attrs val isReq -> @@ -715,7 +726,7 @@ index 5fe123e..42fd7d6 100644 , fieldEnctype = UrlEncoded } -@@ -423,18 +658,54 @@ selectField :: (Eq a, RenderMessage site FormMessage) +@@ -378,18 +601,54 @@ selectField :: (Eq a, RenderMessage site FormMessage) => HandlerT site IO (OptionList a) -> Field (HandlerT site IO) a selectField = selectFieldHelper @@ -758,8 +769,8 @@ index 5fe123e..42fd7d6 100644 + ((Text.Blaze.Internal.preEscapedText . pack) ">"); + ((Control.Monad.liftM (toHtml .) getMessageRender) + >>= -+ (\ urender_a2nOk -+ -> (asWidgetT . toWidget) (urender_a2nOk MsgSelectNone))); ++ (\ urender_aJMX ++ -> (asWidgetT . toWidget) (urender_aJMX MsgSelectNone))); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "</option>") }) + -- onOpt @@ -780,9 +791,9 @@ index 5fe123e..42fd7d6 100644 + ((Text.Blaze.Internal.preEscapedText . pack) "</option>") }) + -- inside - -- | Creates a @\<select>@ tag for selecting multiple options. multiSelectFieldList :: (Eq a, RenderMessage site FormMessage, RenderMessage site msg) -@@ -459,11 +730,45 @@ multiSelectField ioptlist = + => [(msg, a)] +@@ -412,11 +671,45 @@ multiSelectField ioptlist = view theId name attrs val isReq = do opts <- fmap olOptions $ handlerToWidget ioptlist let selOpts = map (id &&& (optselected val)) opts @@ -810,20 +821,20 @@ index 5fe123e..42fd7d6 100644 + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) ">"); + Data.Foldable.mapM_ -+ (\ (opt_a2nPy, optsel_a2nPz) ++ (\ (opt_aJNs, optsel_aJNt) + -> do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "<option value=\""); -+ (asWidgetT . toWidget) (toHtml (optionExternalValue opt_a2nPy)); ++ (asWidgetT . toWidget) (toHtml (optionExternalValue opt_aJNs)); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "\""); + condH -+ [(optsel_a2nPz, ++ [(optsel_aJNt, + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) " selected"))] + Nothing; + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) ">"); -+ (asWidgetT . toWidget) (toHtml (optionDisplay opt_a2nPy)); ++ (asWidgetT . toWidget) (toHtml (optionDisplay opt_aJNs)); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "</option>") }) + selOpts; @@ -833,7 +844,7 @@ index 5fe123e..42fd7d6 100644 where optselected (Left _) _ = False optselected (Right vals) opt = (optionInternalValue opt) `elem` vals -@@ -489,37 +794,115 @@ checkboxesField ioptlist = (multiSelectField ioptlist) +@@ -439,54 +732,196 @@ checkboxesField ioptlist = (multiSelectField ioptlist) opts <- fmap olOptions $ handlerToWidget ioptlist let optselected (Left _) _ = False optselected (Right vals) opt = (optionInternalValue opt) `elem` vals @@ -850,25 +861,25 @@ index 5fe123e..42fd7d6 100644 + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "\">"); + Data.Foldable.mapM_ -+ (\ opt_a2nQo ++ (\ opt_aJNI + -> do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) + "<label><input type=\"checkbox\" name=\""); + (asWidgetT . toWidget) (toHtml name); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "\" value=\""); -+ (asWidgetT . toWidget) (toHtml (optionExternalValue opt_a2nQo)); ++ (asWidgetT . toWidget) (toHtml (optionExternalValue opt_aJNI)); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "\""); + condH -+ [(optselected val opt_a2nQo, ++ [(optselected val opt_aJNI, + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) " checked"))] + Nothing; + (asWidgetT . toWidget) ((attrsToHtml . toAttributes) attrs); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) ">"); -+ (asWidgetT . toWidget) (toHtml (optionDisplay opt_a2nQo)); ++ (asWidgetT . toWidget) (toHtml (optionDisplay opt_aJNI)); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "</label>") }) + opts; @@ -876,7 +887,7 @@ index 5fe123e..42fd7d6 100644 + ((Text.Blaze.Internal.preEscapedText . pack) "</span>") } + } - -- | Creates an input with @type="radio"@ for selecting one option. + radioField :: (Eq a, RenderMessage site FormMessage) => HandlerT site IO (OptionList a) -> Field (HandlerT site IO) a @@ -931,8 +942,8 @@ index 5fe123e..42fd7d6 100644 + ((Text.Blaze.Internal.preEscapedText . pack) ">"); + ((Control.Monad.liftM (toHtml .) getMessageRender) + >>= -+ (\ urender_a2nR7 -+ -> (asWidgetT . toWidget) (urender_a2nR7 MsgSelectNone))); ++ (\ urender_aJNY ++ -> (asWidgetT . toWidget) (urender_aJNY MsgSelectNone))); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "</div></label>") }) + @@ -972,9 +983,6 @@ index 5fe123e..42fd7d6 100644 + ((Text.Blaze.Internal.preEscapedText . pack) "</div></label>") }) + - -- | Creates a group of radio buttons to answer the question given in the message. Radio buttons are used to allow differentiating between an empty response (@Nothing@) and a no response (@Just False@). Consider using the simpler 'checkBoxField' if you don't need to make this distinction. - -- -@@ -531,19 +914,83 @@ $newline never boolField :: Monad m => RenderMessage (HandlerSite m) FormMessage => Field m Bool boolField = Field { fieldParse = \e _ -> return $ boolParser e @@ -984,9 +992,6 @@ index 5fe123e..42fd7d6 100644 - <input id=#{theId}-none *{attrs} type=radio name=#{name} value=none checked> - <label for=#{theId}-none>_{MsgSelectNone} - -- --<input id=#{theId}-yes *{attrs} type=radio name=#{name} value=yes :showVal id val:checked> --<label for=#{theId}-yes>_{MsgBoolYes} + , fieldView = \theId name attrs val isReq -> do { condH + [(not isReq, + do { (asWidgetT . toWidget) @@ -1007,8 +1012,8 @@ index 5fe123e..42fd7d6 100644 + ((Text.Blaze.Internal.preEscapedText . pack) "-none\">"); + ((Control.Monad.liftM (toHtml .) getMessageRender) + >>= -+ (\ urender_a2nSk -+ -> (asWidgetT . toWidget) (urender_a2nSk MsgSelectNone))); ++ (\ urender_aJOn ++ -> (asWidgetT . toWidget) (urender_aJOn MsgSelectNone))); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "</label>") })] + Nothing; @@ -1034,8 +1039,8 @@ index 5fe123e..42fd7d6 100644 + ((Text.Blaze.Internal.preEscapedText . pack) "-yes\">"); + ((Control.Monad.liftM (toHtml .) getMessageRender) + >>= -+ (\ urender_a2nSl -+ -> (asWidgetT . toWidget) (urender_a2nSl MsgBoolYes))); ++ (\ urender_aJOo ++ -> (asWidgetT . toWidget) (urender_aJOo MsgBoolYes))); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) + "</label><input id=\""); @@ -1059,18 +1064,21 @@ index 5fe123e..42fd7d6 100644 + ((Text.Blaze.Internal.preEscapedText . pack) "-no\">"); + ((Control.Monad.liftM (toHtml .) getMessageRender) + >>= -+ (\ urender_a2nSm -+ -> (asWidgetT . toWidget) (urender_a2nSm MsgBoolNo))); ++ (\ urender_aJOp ++ -> (asWidgetT . toWidget) (urender_aJOp MsgBoolNo))); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "</label>") } +-<input id=#{theId}-yes *{attrs} type=radio name=#{name} value=yes :showVal id val:checked> +-<label for=#{theId}-yes>_{MsgBoolYes} +- -<input id=#{theId}-no *{attrs} type=radio name=#{name} value=no :showVal not val:checked> -<label for=#{theId}-no>_{MsgBoolNo} -|] , fieldEnctype = UrlEncoded } where -@@ -570,10 +1017,24 @@ $newline never +@@ -512,10 +947,24 @@ $newline never checkBoxField :: Monad m => RenderMessage (HandlerSite m) FormMessage => Field m Bool checkBoxField = Field { fieldParse = \e _ -> return $ checkBoxParser e @@ -1099,31 +1107,25 @@ index 5fe123e..42fd7d6 100644 , fieldEnctype = UrlEncoded } -@@ -619,66 +1080,6 @@ optionsPairs opts = do +@@ -559,69 +1008,6 @@ optionsPairs opts = do optionsEnum :: (MonadHandler m, Show a, Enum a, Bounded a) => m (OptionList a) optionsEnum = optionsPairs $ map (\x -> (pack $ show x, x)) [minBound..maxBound] ---- | Selects a list of 'Entity's with the given 'Filter' and 'SelectOpt's. The @(a -> msg)@ function is then used to derive the display value for an 'OptionList'. Example usage: ---- ---- > Country ---- > name Text ---- > deriving Eq -- Must derive Eq ---- ---- > data CountryForm = CountryForm ---- > { country :: Entity Country ---- > } ---- > ---- > countryNameForm :: AForm Handler CountryForm ---- > countryNameForm = CountryForm ---- > <$> areq (selectField countries) "Which country do you live in?" Nothing ---- > where ---- > countries = optionsPersist [] [Asc CountryName] countryName +-#if MIN_VERSION_persistent(2, 0, 0) -optionsPersist :: ( YesodPersist site, PersistEntity a - , PersistQuery (PersistEntityBackend a) - , PathPiece (Key a) - , RenderMessage site msg - , YesodPersistBackend site ~ PersistEntityBackend a - ) +-#else +-optionsPersist :: ( YesodPersist site, PersistEntity a +- , PersistQuery (YesodPersistBackend site (HandlerT site IO)) +- , PathPiece (Key a) +- , PersistEntityBackend a ~ PersistMonadBackend (YesodPersistBackend site (HandlerT site IO)) +- , RenderMessage site msg +- ) +-#endif - => [Filter a] - -> [SelectOpt a] - -> (a -> msg) @@ -1137,10 +1139,11 @@ index 5fe123e..42fd7d6 100644 - , optionExternalValue = toPathPiece key - }) pairs - ---- | An alternative to 'optionsPersist' which returns just the 'Key' instead of ---- the entire 'Entity'. +--- | An alternative to 'optionsPersist' which returns just the @Key@ instead of +--- the entire @Entity@. --- --- Since 1.3.2 +-#if MIN_VERSION_persistent(2, 0, 0) -optionsPersistKey - :: (YesodPersist site - , PersistEntity a @@ -1149,6 +1152,15 @@ index 5fe123e..42fd7d6 100644 - , RenderMessage site msg - , YesodPersistBackend site ~ PersistEntityBackend a - ) +-#else +-optionsPersistKey +- :: (YesodPersist site +- , PersistEntity a +- , PersistQuery (YesodPersistBackend site (HandlerT site IO)) +- , PathPiece (Key a) +- , RenderMessage site msg +- , PersistEntityBackend a ~ PersistMonadBackend (YesodDB site)) +-#endif - => [Filter a] - -> [SelectOpt a] - -> (a -> msg) @@ -1162,18 +1174,17 @@ index 5fe123e..42fd7d6 100644 - , optionInternalValue = key - , optionExternalValue = toPathPiece key - }) pairs -- + selectFieldHelper :: (Eq a, RenderMessage site FormMessage) - => (Text -> Text -> [(Text, Text)] -> WidgetT site IO () -> WidgetT site IO ()) -@@ -722,9 +1123,21 @@ fileField = Field +@@ -665,9 +1051,21 @@ fileField = Field case files of [] -> Right Nothing file:_ -> Right $ Just file - , fieldView = \id' name attrs _ isReq -> toWidget [hamlet| - <input id=#{id'} name=#{name} *{attrs} type=file :isReq:required> - |] -+ , fieldView = \id' name attrs _ isReq -> toWidget $ \ _render_a2nUV ++ , fieldView = \id' name attrs _ isReq -> toWidget $ \ _render_aJPt + -> do { id + ((Text.Blaze.Internal.preEscapedText . pack) "<input id=\""); + id (toHtml id'); @@ -1191,7 +1202,7 @@ index 5fe123e..42fd7d6 100644 , fieldEnctype = Multipart } -@@ -751,10 +1164,19 @@ fileAFormReq fs = AForm $ \(site, langs) menvs ints -> do +@@ -694,10 +1092,19 @@ fileAFormReq fs = AForm $ \(site, langs) menvs ints -> do { fvLabel = toHtml $ renderMessage site langs $ fsLabel fs , fvTooltip = fmap (toHtml . renderMessage site langs) $ fsTooltip fs , fvId = id' @@ -1215,7 +1226,7 @@ index 5fe123e..42fd7d6 100644 , fvErrors = errs , fvRequired = True } -@@ -783,10 +1205,19 @@ fileAFormOpt fs = AForm $ \(master, langs) menvs ints -> do +@@ -726,10 +1133,19 @@ fileAFormOpt fs = AForm $ \(master, langs) menvs ints -> do { fvLabel = toHtml $ renderMessage master langs $ fsLabel fs , fvTooltip = fmap (toHtml . renderMessage master langs) $ fsTooltip fs , fvId = id' @@ -1240,26 +1251,28 @@ index 5fe123e..42fd7d6 100644 , fvRequired = False } diff --git a/Yesod/Form/Functions.hs b/Yesod/Form/Functions.hs -index 0d83b79..61e9b66 100644 +index 9e6abaf..0c2a0ce 100644 --- a/Yesod/Form/Functions.hs +++ b/Yesod/Form/Functions.hs -@@ -60,12 +60,14 @@ import Text.Blaze (Markup, toMarkup) +@@ -60,12 +60,16 @@ import Text.Blaze (Markup, toMarkup) #define toHtml toMarkup import Yesod.Core import Network.Wai (requestMethod) -import Text.Hamlet (shamlet) ++--import Text.Hamlet (shamlet) import Data.Monoid (mempty) import Data.Maybe (listToMaybe, fromMaybe) import qualified Data.Map as Map import qualified Data.Text.Encoding as TE import Control.Arrow (first) -+import qualified Text.Hamlet +import qualified Text.Blaze.Internal ++import qualified Yesod.Core.Widget +import qualified Data.Foldable ++import qualified Text.Hamlet -- | Get a unique identifier. newFormIdent :: Monad m => MForm m Text -@@ -217,7 +219,14 @@ postHelper form env = do +@@ -217,7 +221,14 @@ postHelper form env = do let token = case reqToken req of Nothing -> mempty @@ -1275,7 +1288,7 @@ index 0d83b79..61e9b66 100644 m <- getYesod langs <- languages ((res, xml), enctype) <- runFormGeneric (form token) m langs env -@@ -298,7 +307,12 @@ getHelper :: MonadHandler m +@@ -297,7 +308,12 @@ getHelper :: MonadHandler m -> Maybe (Env, FileEnv) -> m (a, Enctype) getHelper form env = do @@ -1289,7 +1302,7 @@ index 0d83b79..61e9b66 100644 langs <- languages m <- getYesod runFormGeneric (form fragment) m langs env -@@ -333,10 +347,15 @@ identifyForm +@@ -332,10 +348,15 @@ identifyForm identifyForm identVal form = \fragment -> do -- Create hidden <input>. let fragment' = @@ -1309,7 +1322,7 @@ index 0d83b79..61e9b66 100644 -- Check if we got its value back. mp <- askParams -@@ -366,22 +385,70 @@ renderTable, renderDivs, renderDivsNoLabels :: Monad m => FormRender m a +@@ -365,22 +386,70 @@ renderTable, renderDivs, renderDivsNoLabels :: Monad m => FormRender m a renderTable aform fragment = do (res, views') <- aFormToForm aform let views = views' [] @@ -1332,20 +1345,20 @@ index 0d83b79..61e9b66 100644 + let widget = do { Text.Hamlet.condH + [(null views, (asWidgetT . toWidget) (toHtml fragment))] Nothing; + Data.Foldable.mapM_ -+ (\ (isFirst_aNqW, view_aNqX) ++ (\ (isFirst_ab5u, view_ab5v) + -> do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "<tr"); + Text.Hamlet.condH -+ [(or [fvRequired view_aNqX, not (fvRequired view_aNqX)], ++ [(or [fvRequired view_ab5v, not (fvRequired view_ab5v)], + do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) " class=\""); + Text.Hamlet.condH -+ [(fvRequired view_aNqX, ++ [(fvRequired view_ab5v, + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "required "))] + Nothing; + Text.Hamlet.condH -+ [(not (fvRequired view_aNqX), ++ [(not (fvRequired view_ab5v), + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "optional"))] + Nothing; @@ -1355,37 +1368,37 @@ index 0d83b79..61e9b66 100644 + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "><td>"); + Text.Hamlet.condH -+ [(isFirst_aNqW, (asWidgetT . toWidget) (toHtml fragment))] Nothing; ++ [(isFirst_ab5u, (asWidgetT . toWidget) (toHtml fragment))] Nothing; + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "<label for=\""); -+ (asWidgetT . toWidget) (toHtml (fvId view_aNqX)); ++ (asWidgetT . toWidget) (toHtml (fvId view_ab5v)); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "\">"); -+ (asWidgetT . toWidget) (toHtml (fvLabel view_aNqX)); ++ (asWidgetT . toWidget) (toHtml (fvLabel view_ab5v)); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "</label>"); + Text.Hamlet.maybeH -+ (fvTooltip view_aNqX) -+ (\ tt_aNqY ++ (fvTooltip view_ab5v) ++ (\ tt_ab5w + -> do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) + "<div class=\"tooltip\">"); -+ (asWidgetT . toWidget) (toHtml tt_aNqY); ++ (asWidgetT . toWidget) (toHtml tt_ab5w); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "</div>") }) + Nothing; + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "</td><td>"); -+ (asWidgetT . toWidget) (fvInput view_aNqX); ++ (asWidgetT . toWidget) (fvInput view_ab5v); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "</td>"); + Text.Hamlet.maybeH -+ (fvErrors view_aNqX) -+ (\ err_aNqZ ++ (fvErrors view_ab5v) ++ (\ err_ab5x + -> do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) + "<td class=\"errors\">"); -+ (asWidgetT . toWidget) (toHtml err_aNqZ); ++ (asWidgetT . toWidget) (toHtml err_ab5x); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "</td>") }) + Nothing; @@ -1396,7 +1409,7 @@ index 0d83b79..61e9b66 100644 return (res, widget) where addIsFirst [] = [] -@@ -397,19 +464,66 @@ renderDivsMaybeLabels :: Monad m => Bool -> FormRender m a +@@ -396,19 +465,66 @@ renderDivsMaybeLabels :: Monad m => Bool -> FormRender m a renderDivsMaybeLabels withLabels aform fragment = do (res, views') <- aFormToForm aform let views = views' [] @@ -1415,20 +1428,20 @@ index 0d83b79..61e9b66 100644 -|] + let widget = do { (asWidgetT . toWidget) (toHtml fragment); + Data.Foldable.mapM_ -+ (\ view_aNsz ++ (\ view_ab5K + -> do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "<div"); + Text.Hamlet.condH -+ [(or [fvRequired view_aNsz, not (fvRequired view_aNsz)], ++ [(or [fvRequired view_ab5K, not (fvRequired view_ab5K)], + do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) " class=\""); + Text.Hamlet.condH -+ [(fvRequired view_aNsz, ++ [(fvRequired view_ab5K, + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "required "))] + Nothing; + Text.Hamlet.condH -+ [(not (fvRequired view_aNsz), ++ [(not (fvRequired view_ab5K), + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "optional"))] + Nothing; @@ -1441,31 +1454,31 @@ index 0d83b79..61e9b66 100644 + [(withLabels, + do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "<label for=\""); -+ (asWidgetT . toWidget) (toHtml (fvId view_aNsz)); ++ (asWidgetT . toWidget) (toHtml (fvId view_ab5K)); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "\">"); -+ (asWidgetT . toWidget) (toHtml (fvLabel view_aNsz)); ++ (asWidgetT . toWidget) (toHtml (fvLabel view_ab5K)); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "</label>") })] + Nothing; + Text.Hamlet.maybeH -+ (fvTooltip view_aNsz) -+ (\ tt_aNsL ++ (fvTooltip view_ab5K) ++ (\ tt_ab5L + -> do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) + "<div class=\"tooltip\">"); -+ (asWidgetT . toWidget) (toHtml tt_aNsL); ++ (asWidgetT . toWidget) (toHtml tt_ab5L); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "</div>") }) + Nothing; -+ (asWidgetT . toWidget) (fvInput view_aNsz); ++ (asWidgetT . toWidget) (fvInput view_ab5K); + Text.Hamlet.maybeH -+ (fvErrors view_aNsz) -+ (\ err_aNsP ++ (fvErrors view_ab5K) ++ (\ err_ab5M + -> do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) + "<div class=\"errors\">"); -+ (asWidgetT . toWidget) (toHtml err_aNsP); ++ (asWidgetT . toWidget) (toHtml err_ab5M); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "</div>") }) + Nothing; @@ -1476,7 +1489,7 @@ index 0d83b79..61e9b66 100644 return (res, widget) -- | Render a form using Bootstrap v2-friendly shamlet syntax. -@@ -437,19 +551,62 @@ renderBootstrap2 aform fragment = do +@@ -436,19 +552,62 @@ renderBootstrap2 aform fragment = do let views = views' [] has (Just _) = True has Nothing = False @@ -1495,53 +1508,53 @@ index 0d83b79..61e9b66 100644 - |] + let widget = do { (asWidgetT . toWidget) (toHtml fragment); + Data.Foldable.mapM_ -+ (\ view_aNw8 ++ (\ view_ab5Y + -> do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) + "<div class=\"control-group clearfix "); + Text.Hamlet.condH -+ [(fvRequired view_aNw8, ++ [(fvRequired view_ab5Y, + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "required "))] + Nothing; + Text.Hamlet.condH -+ [(not (fvRequired view_aNw8), ++ [(not (fvRequired view_ab5Y), + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "optional "))] + Nothing; + Text.Hamlet.condH -+ [(has (fvErrors view_aNw8), ++ [(has (fvErrors view_ab5Y), + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "error"))] + Nothing; + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) + "\"><label class=\"control-label\" for=\""); -+ (asWidgetT . toWidget) (toHtml (fvId view_aNw8)); ++ (asWidgetT . toWidget) (toHtml (fvId view_ab5Y)); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "\">"); -+ (asWidgetT . toWidget) (toHtml (fvLabel view_aNw8)); ++ (asWidgetT . toWidget) (toHtml (fvLabel view_ab5Y)); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) + "</label><div class=\"controls input\">"); -+ (asWidgetT . toWidget) (fvInput view_aNw8); ++ (asWidgetT . toWidget) (fvInput view_ab5Y); + Text.Hamlet.maybeH -+ (fvTooltip view_aNw8) -+ (\ tt_aNw9 ++ (fvTooltip view_ab5Y) ++ (\ tt_ab5Z + -> do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) + "<span class=\"help-block\">"); -+ (asWidgetT . toWidget) (toHtml tt_aNw9); ++ (asWidgetT . toWidget) (toHtml tt_ab5Z); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "</span>") }) + Nothing; + Text.Hamlet.maybeH -+ (fvErrors view_aNw8) -+ (\ err_aNwa ++ (fvErrors view_ab5Y) ++ (\ err_ab60 + -> do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) + "<span class=\"help-block\">"); -+ (asWidgetT . toWidget) (toHtml err_aNwa); ++ (asWidgetT . toWidget) (toHtml err_ab60); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) "</span>") }) + Nothing; @@ -1553,15 +1566,16 @@ index 0d83b79..61e9b66 100644 -- | Deprecated synonym for 'renderBootstrap2'. diff --git a/Yesod/Form/Jquery.hs b/Yesod/Form/Jquery.hs -index 63e3d57..47503c2 100644 +index 362eb8a..1df9966 100644 --- a/Yesod/Form/Jquery.hs +++ b/Yesod/Form/Jquery.hs -@@ -18,11 +18,23 @@ import Yesod.Core +@@ -17,11 +17,23 @@ import Yesod.Core import Yesod.Form import Data.Time (Day) import Data.Default -import Text.Hamlet (shamlet) -import Text.Julius (julius, rawJS) ++--import Text.Hamlet (shamlet) +import Text.Julius (rawJS) import Data.Text (Text, pack, unpack) import Data.Monoid (mconcat) @@ -1577,27 +1591,25 @@ index 63e3d57..47503c2 100644 +import qualified Text.Julius +import qualified Data.Text.Lazy.Builder +import qualified Text.Shakespeare -+import qualified Data.Text.Lazy.Builder as Data.Text.Internal.Builder + -- | Gets the Google hosted jQuery UI 1.8 CSS file with the given theme. googleHostedJqueryUiCss :: Text -> Text googleHostedJqueryUiCss theme = mconcat -@@ -71,27 +83,54 @@ jqueryDayField' jds inputType = Field +@@ -61,27 +73,59 @@ jqueryDayField jds = Field . readMay . unpack , fieldView = \theId name attrs val isReq -> do - toWidget [shamlet| -$newline never --<input id="#{theId}" name="#{name}" *{attrs} type="#{inputType}" :isReq:required="" value="#{showVal val}"> +-<input id="#{theId}" name="#{name}" *{attrs} type="date" :isReq:required="" value="#{showVal val}"> -|] + toWidget $ do { id + ((Text.Blaze.Internal.preEscapedText . pack) "<input id=\""); + id (toHtml theId); + id ((Text.Blaze.Internal.preEscapedText . pack) "\" name=\""); + id (toHtml name); -+ id ((Text.Blaze.Internal.preEscapedText . pack) "\" type=\""); -+ id (toHtml inputType); -+ id ((Text.Blaze.Internal.preEscapedText . pack) "\""); ++ id ++ ((Text.Blaze.Internal.preEscapedText . pack) "\" type=\"date\""); + Text.Hamlet.condH + [(isReq, + id ((Text.Blaze.Internal.preEscapedText . pack) " required=\"\""))] @@ -1626,36 +1638,42 @@ index 63e3d57..47503c2 100644 -}); -|] + toWidget $ Text.Julius.asJavascriptUrl -+ (\ _render_a3iGM ++ (\ _render_a2l4S + -> mconcat + [Text.Julius.Javascript -+ ((Data.Text.Internal.Builder.fromText . Text.Shakespeare.pack') -+ "\n\n$(function(){\n\n var i = document.getElementById(\""), ++ ((Data.Text.Lazy.Builder.fromText ++ . Text.Shakespeare.pack') ++ "\n$(function(){\n var i = document.getElementById(\""), + Text.Julius.toJavascript (rawJS theId), + Text.Julius.Javascript -+ ((Data.Text.Internal.Builder.fromText . Text.Shakespeare.pack') -+ "\");\n\n if (i.type != \"date\") {\n\n $(i).datepicker({\n\n dateFormat:'yy-mm-dd',\n\n changeMonth:"), ++ ((Data.Text.Lazy.Builder.fromText ++ . Text.Shakespeare.pack') ++ "\");\n if (i.type != \"date\") {\n $(i).datepicker({\n dateFormat:'yy-mm-dd',\n changeMonth:"), + Text.Julius.toJavascript (jsBool (jdsChangeMonth jds)), + Text.Julius.Javascript -+ ((Data.Text.Internal.Builder.fromText . Text.Shakespeare.pack') -+ ",\n\n changeYear:"), ++ ((Data.Text.Lazy.Builder.fromText ++ . Text.Shakespeare.pack') ++ ",\n changeYear:"), + Text.Julius.toJavascript (jsBool (jdsChangeYear jds)), + Text.Julius.Javascript -+ ((Data.Text.Internal.Builder.fromText . Text.Shakespeare.pack') -+ ",\n\n numberOfMonths:"), ++ ((Data.Text.Lazy.Builder.fromText ++ . Text.Shakespeare.pack') ++ ",\n numberOfMonths:"), + Text.Julius.toJavascript (rawJS (mos (jdsNumberOfMonths jds))), + Text.Julius.Javascript -+ ((Data.Text.Internal.Builder.fromText . Text.Shakespeare.pack') -+ ",\n\n yearRange:"), ++ ((Data.Text.Lazy.Builder.fromText ++ . Text.Shakespeare.pack') ++ ",\n yearRange:"), + Text.Julius.toJavascript (toJSON (jdsYearRange jds)), + Text.Julius.Javascript -+ ((Data.Text.Internal.Builder.fromText . Text.Shakespeare.pack') -+ "\n\n });\n\n }\n\n});")]) ++ ((Data.Text.Lazy.Builder.fromText ++ . Text.Shakespeare.pack') ++ "\n });\n }\n});")]) + , fieldEnctype = UrlEncoded } where -@@ -118,16 +157,47 @@ jqueryAutocompleteField' :: (RenderMessage site FormMessage, YesodJquery site) +@@ -108,16 +152,52 @@ jqueryAutocompleteField' :: (RenderMessage site FormMessage, YesodJquery site) jqueryAutocompleteField' minLen src = Field { fieldParse = parseHelper $ Right , fieldView = \theId name attrs val isReq -> do @@ -1688,35 +1706,40 @@ index 63e3d57..47503c2 100644 -$(function(){$("##{rawJS theId}").autocomplete({source:"@{src}",minLength:#{toJSON minLen}})}); -|] + toWidget $ Text.Julius.asJavascriptUrl -+ (\ _render_a3iHO ++ (\ _render_a2l58 + -> mconcat + [Text.Julius.Javascript -+ ((Data.Text.Internal.Builder.fromText . Text.Shakespeare.pack') -+ "\n\n$(function(){$(\"#"), ++ ((Data.Text.Lazy.Builder.fromText ++ . Text.Shakespeare.pack') ++ "\n$(function(){$(\"#"), + Text.Julius.toJavascript (rawJS theId), + Text.Julius.Javascript -+ ((Data.Text.Internal.Builder.fromText . Text.Shakespeare.pack') ++ ((Data.Text.Lazy.Builder.fromText ++ . Text.Shakespeare.pack') + "\").autocomplete({source:\""), + Text.Julius.Javascript -+ (Data.Text.Internal.Builder.fromText (_render_a3iHO src [])), ++ (Data.Text.Lazy.Builder.fromText ++ (_render_a2l58 src [])), + Text.Julius.Javascript -+ ((Data.Text.Internal.Builder.fromText . Text.Shakespeare.pack') ++ ((Data.Text.Lazy.Builder.fromText ++ . Text.Shakespeare.pack') + "\",minLength:"), + Text.Julius.toJavascript (toJSON minLen), + Text.Julius.Javascript -+ ((Data.Text.Internal.Builder.fromText . Text.Shakespeare.pack') ++ ((Data.Text.Lazy.Builder.fromText ++ . Text.Shakespeare.pack') + "})});")]) + , fieldEnctype = UrlEncoded } diff --git a/Yesod/Form/MassInput.hs b/Yesod/Form/MassInput.hs -index a2b434d..29b45b5 100644 +index a2b434d..75eb484 100644 --- a/Yesod/Form/MassInput.hs +++ b/Yesod/Form/MassInput.hs -@@ -22,6 +22,16 @@ import Data.Traversable (sequenceA) - import qualified Data.Map as Map - import Data.Maybe (listToMaybe) +@@ -9,6 +9,16 @@ module Yesod.Form.MassInput + , massTable + ) where +import qualified Data.Text +import qualified Text.Blaze as Text.Blaze.Internal @@ -1728,9 +1751,9 @@ index a2b434d..29b45b5 100644 +import qualified Data.Foldable +import qualified Control.Monad + - down :: Monad m => Int -> MForm m () - down 0 = return () - down i | i < 0 = error "called down with a negative number" + import Yesod.Form.Types + import Yesod.Form.Functions + import Yesod.Form.Fields (checkBoxField) @@ -70,16 +80,27 @@ inputList label fixXml single mdef = formToAForm $ do { fvLabel = label , fvTooltip = Nothing @@ -1749,7 +1772,7 @@ index a2b434d..29b45b5 100644 + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) "<p>"); + Data.Foldable.mapM_ -+ (\ xml_a3hPg -> (asWidgetT . toWidget) xml_a3hPg) xmls; ++ (\ xml_a1yM1 -> (asWidgetT . toWidget) xml_a1yM1) xmls; + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) + "<input class=\"count\" type=\"hidden\" name=\""); @@ -1806,27 +1829,27 @@ index a2b434d..29b45b5 100644 - <div .errors>#{err} -|] +massDivs viewss = Data.Foldable.mapM_ -+ (\ views_a3hPz ++ (\ views_a1yMm + -> do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) + "<fieldset>"); + Data.Foldable.mapM_ -+ (\ view_a3hPA ++ (\ view_a1yMn + -> do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) "<div"); + Text.Hamlet.condH -+ [(or [fvRequired view_a3hPA, not (fvRequired view_a3hPA)], ++ [(or [fvRequired view_a1yMn, not (fvRequired view_a1yMn)], + do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) + " class=\""); + Text.Hamlet.condH -+ [(fvRequired view_a3hPA, ++ [(fvRequired view_a1yMn, + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) + "required "))] + Nothing; + Text.Hamlet.condH -+ [(not (fvRequired view_a3hPA), ++ [(not (fvRequired view_a1yMn), + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) + "optional"))] @@ -1838,38 +1861,38 @@ index a2b434d..29b45b5 100644 + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) + "><label for=\""); -+ (asWidgetT . toWidget) (toHtml (fvId view_a3hPA)); ++ (asWidgetT . toWidget) (toHtml (fvId view_a1yMn)); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) "\">"); -+ (asWidgetT . toWidget) (toHtml (fvLabel view_a3hPA)); ++ (asWidgetT . toWidget) (toHtml (fvLabel view_a1yMn)); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) "</label>"); + Text.Hamlet.maybeH -+ (fvTooltip view_a3hPA) -+ (\ tt_a3hPB ++ (fvTooltip view_a1yMn) ++ (\ tt_a1yMo + -> do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) + "<div class=\"tooltip\">"); -+ (asWidgetT . toWidget) (toHtml tt_a3hPB); ++ (asWidgetT . toWidget) (toHtml tt_a1yMo); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) + "</div>") }) + Nothing; -+ (asWidgetT . toWidget) (fvInput view_a3hPA); ++ (asWidgetT . toWidget) (fvInput view_a1yMn); + Text.Hamlet.maybeH -+ (fvErrors view_a3hPA) -+ (\ err_a3hPC ++ (fvErrors view_a1yMn) ++ (\ err_a1yMp + -> do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) + "<div class=\"errors\">"); -+ (asWidgetT . toWidget) (toHtml err_a3hPC); ++ (asWidgetT . toWidget) (toHtml err_a1yMp); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) + "</div>") }) + Nothing; + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) "</div>") }) -+ views_a3hPz; ++ views_a1yMm; + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) + "</fieldset>") }) @@ -1877,27 +1900,27 @@ index a2b434d..29b45b5 100644 + + +massTable viewss = Data.Foldable.mapM_ -+ (\ views_a3hPH ++ (\ views_a1yMv + -> do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) + "<fieldset><table>"); + Data.Foldable.mapM_ -+ (\ view_a3hPI ++ (\ view_a1yMw + -> do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) "<tr"); + Text.Hamlet.condH -+ [(or [fvRequired view_a3hPI, not (fvRequired view_a3hPI)], ++ [(or [fvRequired view_a1yMw, not (fvRequired view_a1yMw)], + do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) + " class=\""); + Text.Hamlet.condH -+ [(fvRequired view_a3hPI, ++ [(fvRequired view_a1yMw, + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) + "required "))] + Nothing; + Text.Hamlet.condH -+ [(not (fvRequired view_a3hPI), ++ [(not (fvRequired view_a1yMw), + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) + "optional"))] @@ -1909,19 +1932,19 @@ index a2b434d..29b45b5 100644 + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) + "><td><label for=\""); -+ (asWidgetT . toWidget) (toHtml (fvId view_a3hPI)); ++ (asWidgetT . toWidget) (toHtml (fvId view_a1yMw)); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) "\">"); -+ (asWidgetT . toWidget) (toHtml (fvLabel view_a3hPI)); ++ (asWidgetT . toWidget) (toHtml (fvLabel view_a1yMw)); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) "</label>"); + Text.Hamlet.maybeH -+ (fvTooltip view_a3hPI) -+ (\ tt_a3hPJ ++ (fvTooltip view_a1yMw) ++ (\ tt_a1yMx + -> do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) + "<div class=\"tooltip\">"); -+ (asWidgetT . toWidget) (toHtml tt_a3hPJ); ++ (asWidgetT . toWidget) (toHtml tt_a1yMx); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) + "</div>") }) @@ -1929,23 +1952,23 @@ index a2b434d..29b45b5 100644 + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) + "</td><td>"); -+ (asWidgetT . toWidget) (fvInput view_a3hPI); ++ (asWidgetT . toWidget) (fvInput view_a1yMw); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) "</td>"); + Text.Hamlet.maybeH -+ (fvErrors view_a3hPI) -+ (\ err_a3hPK ++ (fvErrors view_a1yMw) ++ (\ err_a1yMy + -> do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) + "<td class=\"errors\">"); -+ (asWidgetT . toWidget) (toHtml err_a3hPK); ++ (asWidgetT . toWidget) (toHtml err_a1yMy); + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) + "</td>") }) + Nothing; + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) "</tr>") }) -+ views_a3hPH; ++ views_a1yMv; + (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . Data.Text.pack) + "</table></fieldset>") }) @@ -1967,19 +1990,12 @@ index a2b434d..29b45b5 100644 - <td .errors>#{err} -|] diff --git a/Yesod/Form/Nic.hs b/Yesod/Form/Nic.hs -index 2862678..a773553 100644 +index 7e4af07..b59745a 100644 --- a/Yesod/Form/Nic.hs +++ b/Yesod/Form/Nic.hs -@@ -12,12 +12,24 @@ module Yesod.Form.Nic - import Yesod.Core - import Yesod.Form - import Text.HTML.SanitizeXSS (sanitizeBalance) --import Text.Hamlet (shamlet) --import Text.Julius (julius, rawJS) -+import Text.Julius (rawJS) - import Text.Blaze.Html.Renderer.String (renderHtml) - import Data.Text (Text, pack) - import Data.Maybe (listToMaybe) +@@ -9,11 +9,22 @@ module Yesod.Form.Nic + , nicHtmlField + ) where +import qualified Text.Blaze as Text.Blaze.Internal +import qualified Text.Blaze.Internal @@ -1991,19 +2007,24 @@ index 2862678..a773553 100644 +import qualified Control.Monad +import qualified Text.Julius +import qualified Data.Text.Lazy.Builder -+import qualified Data.Text.Lazy.Builder as Data.Text.Internal.Builder +import qualified Text.Shakespeare + - class Yesod a => YesodNic a where - -- | NIC Editor Javascript file. - urlNicEdit :: a -> Either (Route a) Text -@@ -27,20 +39,44 @@ nicHtmlField :: YesodNic site => Field (HandlerT site IO) Html + import Yesod.Core + import Yesod.Form + import Text.HTML.SanitizeXSS (sanitizeBalance) +-import Text.Hamlet (shamlet) +-import Text.Julius (julius, rawJS) ++import Text.Julius ( rawJS) + import Text.Blaze.Html.Renderer.String (renderHtml) + import Data.Text (Text, pack) + import Data.Maybe (listToMaybe) +@@ -27,20 +38,52 @@ nicHtmlField :: YesodNic site => Field (HandlerT site IO) Html nicHtmlField = Field { fieldParse = \e _ -> return . Right . fmap (preEscapedToMarkup . sanitizeBalance) . listToMaybe $ e - , fieldView = \theId name attrs val _isReq -> do + , fieldView = \theId name attrs val isReq -> do - toWidget [shamlet| -$newline never -- <textarea id="#{theId}" *{attrs} name="#{name}" .html>#{showVal val} +- <textarea id="#{theId}" *{attrs} name="#{name}" :isReq:required .html>#{showVal val} -|] + toWidget $ do { id + ((Text.Blaze.Internal.preEscapedText . pack) @@ -2012,6 +2033,10 @@ index 2862678..a773553 100644 + id ((Text.Blaze.Internal.preEscapedText . pack) "\" name=\""); + id (toHtml name); + id ((Text.Blaze.Internal.preEscapedText . pack) "\""); ++ Text.Hamlet.condH ++ [(isReq, ++ id ((Text.Blaze.Internal.preEscapedText . pack) " required"))] ++ Nothing; + id ((Text.Hamlet.attrsToHtml . Text.Hamlet.toAttributes) attrs); + id ((Text.Blaze.Internal.preEscapedText . pack) ">"); + id (toHtml (showVal val)); @@ -2028,43 +2053,34 @@ index 2862678..a773553 100644 -(function(){new nicEditor({fullPanel:true}).panelInstance("#{rawJS theId}")})(); -|] + BottomOfHeadBlocking -> Text.Julius.asJavascriptUrl -+ (\ _render_a3hYy ++ (\ _render_a2rMh + -> Data.Monoid.mconcat + [Text.Julius.Javascript -+ ((Data.Text.Internal.Builder.fromText . Text.Shakespeare.pack') -+ "\n\nbkLib.onDomLoaded(function(){new nicEditor({fullPanel:true}).panelInstance(\""), ++ ((Data.Text.Lazy.Builder.fromText ++ . Text.Shakespeare.pack') ++ "\nbkLib.onDomLoaded(function(){new nicEditor({fullPanel:true}).panelInstance(\""), + Text.Julius.toJavascript (rawJS theId), + Text.Julius.Javascript -+ ((Data.Text.Internal.Builder.fromText . Text.Shakespeare.pack') ++ ((Data.Text.Lazy.Builder.fromText ++ . Text.Shakespeare.pack') + "\")});")]) + + _ -> Text.Julius.asJavascriptUrl -+ (\ _render_a3i1Q ++ (\ _render_a2rMm + -> Data.Monoid.mconcat + [Text.Julius.Javascript -+ ((Data.Text.Internal.Builder.fromText . Text.Shakespeare.pack') -+ "\n\n(function(){new nicEditor({fullPanel:true}).panelInstance(\""), ++ ((Data.Text.Lazy.Builder.fromText ++ . Text.Shakespeare.pack') ++ "\n(function(){new nicEditor({fullPanel:true}).panelInstance(\""), + Text.Julius.toJavascript (rawJS theId), + Text.Julius.Javascript -+ ((Data.Text.Internal.Builder.fromText . Text.Shakespeare.pack') ++ ((Data.Text.Lazy.Builder.fromText ++ . Text.Shakespeare.pack') + "\")})();")]) + , fieldEnctype = UrlEncoded } where -diff --git a/yesod-form.cabal b/yesod-form.cabal -index 7849763..9694fe1 100644 ---- a/yesod-form.cabal -+++ b/yesod-form.cabal -@@ -23,7 +23,7 @@ library - , yesod-core >= 1.4 && < 1.5 - , yesod-persistent >= 1.4 && < 1.5 - , time >= 1.1.4 -- , shakespeare >= 2.0 -+ , shakespeare >= 2.0.5 - , persistent - , template-haskell - , transformers >= 0.2.2 -- -2.1.4 +2.1.1 |