packages feed

ditto-lucid 0.1.2.0 → 0.1.3.0

raw patch · 2 files changed

+21/−4 lines, 2 filesdep ~dittoPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: ditto

API changes (from Hackage documentation)

+ Ditto.Lucid: withErrors :: (Monad m, ToHtml error, Monad f) => [Attribute] -> ([error] -> HtmlT f ()) -> Form m input error (HtmlT f ()) a -> Form m input error (HtmlT f ()) a

Files

ditto-lucid.cabal view
@@ -1,5 +1,5 @@ Name:                ditto-lucid-Version:             0.1.2.0+Version:             0.1.3.0 Synopsis:            Add support for using lucid with Ditto Description:         Ditto is a library for building and validating forms using applicative functors. This package add support for using ditto with lucid. License:             BSD3@@ -24,7 +24,7 @@   build-depends:       base >4.5 && <5     , lucid < 3.0.0-    , ditto >= 0.1.2.0 && <= 0.2+    , ditto >= 0.1.3.0 && <= 0.2     , text >= 0.11 && < 1.3     , path-pieces   hs-source-dirs: src
src/Ditto/Lucid.hs view
@@ -32,7 +32,7 @@     traverse_ mkHidden hidden *>     children   where-    mkHidden (name, value) = input_ [type_ "hidden", name_ name, value_ value]+  mkHidden (name, value) = input_ [type_ "hidden", name_ name, value_ value]  -- | create @\<form action=action method=\"POST\" enctype=\"application/xxx-form-urlencoded\"\>@ formGenPOST@@ -46,7 +46,7 @@     traverse_ mkHidden hidden *>     children   where-    mkHidden (name, value) = input_ [type_ "hidden", name_ name, value_ value]+  mkHidden (name, value) = input_ [type_ "hidden", name_ name, value_ value]  -- | add an attribute to the 'Html' for a form element. setAttr@@ -85,6 +85,23 @@   mkErrors errs = ul_ [class_ "ditto-error-list"] $ traverse_ mkError errs   mkError :: Monad f => ToHtml a => a -> HtmlT f ()   mkError e = li_ [] $ toHtml e++-- | create a @\<ul\>@ which contains all the errors related to the 'Form'.+--+-- Includes errors from child forms.+--+-- The @<\ul\>@ will have the attribute @class=\"ditto-error-list\"@.+withErrors+  :: (Monad m, ToHtml error, Monad f)+  => [Attribute]+  -> ([error] -> HtmlT f ())+  -> Form m input error (HtmlT f ()) a+  -> Form m input error (HtmlT f ()) a+withErrors attrs renderError form = G.withErrors mkErrors form+  where+  mkErrors formlet errs = +    formlet `with` attrs+    <* renderError errs  -- | create a @\<br\>@ tag. br :: (Monad m, Applicative f) => Form m input error (HtmlT f ()) ()