Mini formlets library.
- data Formlet a = Formlet {
- formletValue :: Params -> Either [Text] a
- formletName :: Maybe Text
- formletHtml :: Params -> Html
- formlet :: Text -> (Maybe Text -> Html) -> Formlet Text
- req :: Formlet Text -> Formlet Text
- opt :: Formlet Text -> Formlet (Maybe Text)
- wrap :: (Html -> Html) -> Formlet Text -> Formlet Text
- integer :: Text -> Either Text Integer
- textInput :: Text -> Text -> Maybe Text -> Formlet Text
- dropInput :: [(Text, Text)] -> Text -> Text -> Text -> Formlet Text
- areaInput :: Text -> Text -> Maybe Text -> Formlet Text
- submitInput :: Text -> Text -> Html
- parse :: (a -> Either Text b) -> Formlet a -> Formlet b
- options :: (o -> Text) -> (o -> Text) -> [o] -> [(Text, Text)]
- findOption :: (o -> Bool) -> [o] -> (o -> internalid) -> Either Text internalid
Documentation
A simple formlet data type, collects errors.
Formlet | |
|
Functor Formlet | Normal instance. |
Applicative Formlet |
textInput :: Text -> Text -> Maybe Text -> Formlet TextSource
Make a text input formlet with a label.
dropInput :: [(Text, Text)] -> Text -> Text -> Text -> Formlet TextSource
Make a drop down input with a label.
submitInput :: Text -> Text -> HtmlSource
Make a submit (captioned) button.
options :: (o -> Text) -> (o -> Text) -> [o] -> [(Text, Text)]Source
Make a list of options for use with the option formlet.
findOption :: (o -> Bool) -> [o] -> (o -> internalid) -> Either Text internalidSource
Lookup a real internal id from a slug.