trasa-form 0.1.0.0 → 0.2.0.0
raw patch · 3 files changed
+25/−19 lines, 3 filesdep ~dittodep ~ditto-lucid
Dependency ranges changed: ditto, ditto-lucid
Files
- app/Main.hs +20/−10
- src/Trasa/Form.hs +0/−4
- trasa-form.cabal +5/−5
app/Main.hs view
@@ -16,7 +16,7 @@ import Data.Text (Text) import Ditto (Result(..)) import Ditto.Core -import Ditto.Lucid+-- import Ditto.Lucid import Ditto.Lucid.Named import Lucid import Network.Wai (Application)@@ -145,15 +145,25 @@ -- pure RecNil formFoo :: TrasaSimpleForm Foo-formFoo = childErrorList ++> ( Foo - <$> label "Int Field 1" "int1" - ++> setAttr [class_ "input"] (inputInt readInt "int1" 0)- <*> label "Bool Field 1" "bool1"- ++> inputYesNo "bool1"- <*> label "Int Field 2" "in2" - ++> inputInt readInt "int2" 0- <* buttonSubmit (const (Right T.empty)) "" "" ("Submit" :: Text)- )+formFoo = do+ label "Int Field 1" "int1"+ int1 <- inputInt readInt "int1" 0+ label "Bool Field 1" "bool1"+ bool1 <- inputYesNo "bool1"+ label "Int Field 2" "in2" + int2 <- inputInt readInt "int2" int1+ buttonSubmit (const (Right T.empty)) "" "" ("Submit" :: Text)+ pure (Foo int1 bool1 int2)++-- childErrorList ++> ( Foo + -- <$> label "Int Field 1" "int1" + -- ++> setAttr [class_ "input"] (inputInt readInt "int1" 0)+ -- <*> label "Bool Field 1" "bool1"+ -- ++> inputYesNo "bool1"+ -- <*> label "Int Field 2" "in2" + -- ++> inputInt readInt "int2" 0+ -- <* buttonSubmit (const (Right T.empty)) "" "" ("Submit" :: Text)+ -- ) prepare :: Route captures query request response -> Arguments captures query request (Prepared Route response) prepare = prepareWith meta
src/Trasa/Form.hs view
@@ -32,10 +32,6 @@ import qualified Data.Text.Lazy as TL import qualified Web.FormUrlEncoded as HTTP -instance FormError Text where- type ErrorInputType Text = Text- commonFormError = T.pack . (commonFormErrorStr T.unpack)- liftParser :: (Text -> Either Text a) -> (QueryParam -> Either Text a) liftParser f q = case q of QueryParamSingle x -> f x
trasa-form.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.0 name: trasa-form-version: 0.1.0.0+version: 0.2.0.0 synopsis: generate forms using lucid, ditto and trasa description: Formlets library for trasa using ditto as its backend. Although trasa already has machinery for creating@@ -33,8 +33,8 @@ , lucid , mtl , quantification- , ditto >= 0.1.2.0 && < 0.2- , ditto-lucid >= 0.1.2.0 && < 0.2+ , ditto >= 0.2 && < 0.3+ , ditto-lucid >= 0.2 && < 0.3 , text , trasa , trasa-server >= 0.5.3@@ -50,8 +50,8 @@ , bytestring , lucid , quantification- , ditto >= 0.1.2.0 && < 0.2- , ditto-lucid >= 0.1.2.0 && < 0.2+ , ditto >= 0.2 && < 0.3+ , ditto-lucid >= 0.2 && < 0.3 , text , trasa == 0.4.* , trasa-extra