yesod-form 1.1.3 → 1.1.4
raw patch · 5 files changed
+16/−19 lines, 5 filesdep −HUnit
Dependencies removed: HUnit
Files
- Yesod/Form/Fields.hs +11/−11
- Yesod/Form/Functions.hs +1/−1
- Yesod/Form/Types.hs +1/−1
- test/main.hs +2/−4
- yesod-form.cabal +1/−2
Yesod/Form/Fields.hs view
@@ -327,17 +327,17 @@ selectField :: (Eq a, RenderMessage master FormMessage) => GHandler sub master (OptionList a) -> Field sub master a selectField = selectFieldHelper- (\theId name inside -> [whamlet|+ (\theId name attrs inside -> [whamlet| $newline never-<select ##{theId} name=#{name}>^{inside}+<select ##{theId} name=#{name} *{attrs}>^{inside} |]) -- outside (\_theId _name isSel -> [whamlet| $newline never <option value=none :isSel:selected>_{MsgSelectNone} |]) -- onOpt- (\_theId _name attrs value isSel text -> [whamlet|+ (\_theId _name _attrs value isSel text -> [whamlet| $newline never-<option value=#{value} :isSel:selected *{attrs}>#{text}+<option value=#{value} :isSel:selected>#{text} |]) -- inside multiSelectFieldList :: (Eq a, RenderMessage master FormMessage, RenderMessage master msg) => [(msg, a)] -> Field sub master [a]@@ -374,7 +374,7 @@ radioField :: (Eq a, RenderMessage master FormMessage) => GHandler sub master (OptionList a) -> Field sub master a radioField = selectFieldHelper- (\theId _name inside -> [whamlet|+ (\theId _name _attrs inside -> [whamlet| $newline never <div ##{theId}>^{inside} |])@@ -494,7 +494,7 @@ selectFieldHelper :: (Eq a, RenderMessage master FormMessage)- => (Text -> Text -> GWidget sub master () -> GWidget sub master ())+ => (Text -> Text -> [(Text, Text)] -> GWidget sub master () -> GWidget sub master ()) -> (Text -> Text -> Bool -> GWidget sub master ()) -> (Text -> Text -> [(Text, Text)] -> Text -> Bool -> Text -> GWidget sub master ()) -> GHandler sub master (OptionList a) -> Field sub master a@@ -504,7 +504,7 @@ return $ selectParser opts x , fieldView = \theId name attrs val isReq -> do opts <- fmap olOptions $ lift opts'- outside theId name $ do+ outside theId name attrs $ do unless isReq $ onOpt theId name $ not $ render opts val `elem` map optionExternalValue opts flip mapM_ opts $ \opt -> inside theId@@ -539,10 +539,10 @@ Nothing -> (FormMissing, Nothing) Just (_, fenv) -> case Map.lookup name fenv of- Nothing ->+ Just (fi:_) -> (FormSuccess fi, Nothing)+ _ -> let t = renderMessage master langs MsgValueRequired in (FormFailure [t], Just $ toHtml t)- Just fi -> (FormSuccess fi, Nothing) let fv = FieldView { fvLabel = toHtml $ renderMessage master langs $ fsLabel fs , fvTooltip = fmap (toHtml . renderMessage master langs) $ fsTooltip fs@@ -570,8 +570,8 @@ Nothing -> (FormMissing, Nothing) Just (_, fenv) -> case Map.lookup name fenv of- Nothing -> (FormSuccess Nothing, Nothing)- Just fi -> (FormSuccess $ Just fi, Nothing)+ Just (fi:_) -> (FormSuccess $ Just fi, Nothing)+ _ -> (FormSuccess Nothing, Nothing) let fv = FieldView { fvLabel = toHtml $ renderMessage master langs $ fsLabel fs , fvTooltip = fmap (toHtml . renderMessage master langs) $ fsTooltip fs
Yesod/Form/Functions.hs view
@@ -224,7 +224,7 @@ else do (p, f) <- runRequestBody let p' = Map.unionsWith (++) $ map (\(x, y) -> Map.singleton x [y]) p- return $ Just (p', Map.fromList f)+ return $ Just (p', Map.unionsWith (++) $ map (\(k, v) -> Map.singleton k [v]) f) runFormPostNoToken :: (Html -> MForm sub master (FormResult a, xml)) -> GHandler sub master ((FormResult a, xml), Enctype) runFormPostNoToken form = do
Yesod/Form/Types.hs view
@@ -76,7 +76,7 @@ show (IntCons i is) = show i ++ ('-' : show is) type Env = Map.Map Text [Text]-type FileEnv = Map.Map Text FileInfo+type FileEnv = Map.Map Text [FileInfo] type Lang = Text type MForm sub master a = RWST (Maybe (Env, FileEnv), master, [Lang]) Enctype Ints (GHandler sub master) a
test/main.hs view
@@ -1,7 +1,5 @@ {-# LANGUAGE OverloadedStrings #-}-import Test.HUnit-import Test.Hspec.Monadic-import Test.Hspec.HUnit ()+import Test.Hspec import Data.Time (TimeOfDay (TimeOfDay)) import Data.Text (pack) @@ -10,7 +8,7 @@ main :: IO () main = hspec $- describe "parseTime" $ mapM_ (\(s, e) -> it s $ parseTime (pack s) @?= e)+ describe "parseTime" $ mapM_ (\(s, e) -> it s $ parseTime (pack s) `shouldBe` e) [ ("01:00:00", Right $ TimeOfDay 1 0 0) , ("1:00", Right $ TimeOfDay 1 0 0) , ("1:00 AM", Right $ TimeOfDay 1 0 0)
yesod-form.cabal view
@@ -1,5 +1,5 @@ name: yesod-form-version: 1.1.3+version: 1.1.4 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>@@ -64,7 +64,6 @@ , yesod-form , time , hspec- , HUnit , text source-repository head