Merge pull request #1530 from pythonissam/expose-selectFieldHelper

Expose select field helper
This commit is contained in:
Chris Allen 2018-06-24 13:24:20 -05:00 committed by GitHub
commit df5ad82a90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 4 deletions

View File

@ -1,3 +1,7 @@
## 1.6.4
* Expose `selectFieldHelper` [#1530](https://github.com/yesodweb/yesod/pull/1530)
## 1.6.3
* Changed `Textarea` to derive `IsString` [#1514](https://github.com/yesodweb/yesod/pull/1514)

View File

@ -42,6 +42,7 @@ module Yesod.Form.Fields
, fileAFormOpt
-- * Options
-- $optionsOverview
, selectFieldHelper
, selectField
, selectFieldList
, radioField
@ -729,11 +730,15 @@ optionsPersistKey filts ords toDisplay = fmap mkOptionList $ do
, optionExternalValue = toPathPiece key
}) pairs
-- |
-- A helper function for constucting 'selectField's. You may want to use this when you define your custom 'selectField's or 'radioField's.
--
-- Since 1.6.4
selectFieldHelper
:: (Eq a, RenderMessage site FormMessage)
=> (Text -> Text -> [(Text, Text)] -> WidgetFor site () -> WidgetFor site ())
-> (Text -> Text -> Bool -> WidgetFor site ())
-> (Text -> Text -> [(Text, Text)] -> Text -> Bool -> Text -> WidgetFor site ())
=> (Text -> Text -> [(Text, Text)] -> WidgetFor site () -> WidgetFor site ()) -- ^ Outermost part of the field
-> (Text -> Text -> Bool -> WidgetFor site ()) -- ^ An option for None if the field is optional
-> (Text -> Text -> [(Text, Text)] -> Text -> Bool -> Text -> WidgetFor site ()) -- ^ Other options
-> HandlerFor site (OptionList a)
-> Field (HandlerFor site) a
selectFieldHelper outside onOpt inside opts' = Field

View File

@ -1,5 +1,5 @@
name: yesod-form
version: 1.6.3
version: 1.6.4
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>