Add some docs for MassInput
This commit is contained in:
parent
3d8c91bae6
commit
5709040dcd
@ -3,6 +3,8 @@
|
|||||||
{-# LANGUAGE TypeFamilies #-}
|
{-# LANGUAGE TypeFamilies #-}
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
{-# LANGUAGE FlexibleContexts #-}
|
||||||
{-# LANGUAGE CPP#-}
|
{-# LANGUAGE CPP#-}
|
||||||
|
-- | A module providing a means of creating multiple input forms, such as a
|
||||||
|
-- list of 0 or more recipients.
|
||||||
module Yesod.Form.MassInput
|
module Yesod.Form.MassInput
|
||||||
( inputList
|
( inputList
|
||||||
, massDivs
|
, massDivs
|
||||||
@ -40,11 +42,19 @@ up i = do
|
|||||||
IntCons _ is' -> put is' >> newFormIdent >> return ()
|
IntCons _ is' -> put is' >> newFormIdent >> return ()
|
||||||
up $ i - 1
|
up $ i - 1
|
||||||
|
|
||||||
|
-- | Generate a form that accepts 0 or more values from the user, allowing the
|
||||||
|
-- user to specify that a new row is necessary.
|
||||||
inputList :: (m ~ HandlerT site IO, xml ~ WidgetT site IO (), RenderMessage site FormMessage)
|
inputList :: (m ~ HandlerT site IO, xml ~ WidgetT site IO (), RenderMessage site FormMessage)
|
||||||
=> Html
|
=> Html
|
||||||
|
-- ^ label for the form
|
||||||
-> ([[FieldView site]] -> xml)
|
-> ([[FieldView site]] -> xml)
|
||||||
|
-- ^ how to display the rows, usually either 'massDivs' or 'massTable'
|
||||||
-> (Maybe a -> AForm (HandlerT site IO) a)
|
-> (Maybe a -> AForm (HandlerT site IO) a)
|
||||||
-> (Maybe [a] -> AForm (HandlerT site IO) [a])
|
-- ^ display a single row of the form, where @Maybe a@ gives the
|
||||||
|
-- previously submitted value
|
||||||
|
-> Maybe [a]
|
||||||
|
-- ^ default initial values for the form
|
||||||
|
-> AForm (HandlerT site IO) [a]
|
||||||
inputList label fixXml single mdef = formToAForm $ do
|
inputList label fixXml single mdef = formToAForm $ do
|
||||||
theId <- lift newIdent
|
theId <- lift newIdent
|
||||||
down 1
|
down 1
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user