Allow multiple files (#448)
This commit is contained in:
parent
5b02ec8079
commit
363e4afeee
@ -539,10 +539,10 @@ fileAFormReq fs = AForm $ \(master, langs) menvs ints -> do
|
||||
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 @@ fileAFormOpt fs = AForm $ \(master, langs) menvs ints -> do
|
||||
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
|
||||
|
||||
@ -224,7 +224,7 @@ postEnv = do
|
||||
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
|
||||
|
||||
@ -76,7 +76,7 @@ instance Show Ints where
|
||||
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
|
||||
|
||||
@ -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>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user