diff --git a/yesod-form/ChangeLog.md b/yesod-form/ChangeLog.md index c38a49dc..5d37f2f8 100644 --- a/yesod-form/ChangeLog.md +++ b/yesod-form/ChangeLog.md @@ -1,5 +1,9 @@ # ChangeLog for yesod-form +## 1.7.0 + +* Extended `OptionList` by `OptionListGrouped` and implemented grouped select fields (`@ tag with @\@s for selecting one option. +-- +-- @since 1.7.0 selectFieldListGrouped :: (Eq a, RenderMessage site FormMessage, RenderMessage site msg) => [(msg, [(msg, a)])] -> Field (HandlerFor site) a @@ -611,6 +613,8 @@ $newline never showVal = either (\_ -> False) -- | A structure holding a list of options. Typically you can use a convenience function like 'mkOptionList' or 'optionsPairs' instead of creating this directly. +-- +-- Extended by 'OptionListGrouped' in 1.7.0. data OptionList a = OptionList { olOptions :: [Option a] @@ -622,11 +626,13 @@ data OptionList a } -- | Convert grouped 'OptionList' to a normal one. +-- +-- @since 1.7.0 flattenOptionList :: OptionList a -> OptionList a flattenOptionList (OptionListGrouped os re) = OptionList (concatMap snd os) re flattenOptionList ol = ol --- | Since 1.4.6 +-- | @since 1.4.6 instance Functor OptionList where fmap f (OptionList options readExternal) = OptionList ((fmap.fmap) f options) (fmap f . readExternal) @@ -641,6 +647,8 @@ mkOptionList os = OptionList } -- | Creates an 'OptionList', using a 'Map' to implement the 'olReadExternalGrouped' function. +-- +-- @since 1.7.0 mkOptionListGrouped :: [(Text, [Option a])] -> OptionList a mkOptionListGrouped os = OptionListGrouped { olOptionsGrouped = os @@ -653,7 +661,7 @@ data Option a = Option , optionExternalValue :: Text -- ^ The representation of this value stored in the form. } --- | Since 1.4.6 +-- | @since 1.4.6 instance Functor Option where fmap f (Option display internal external) = Option display (f internal) external @@ -670,6 +678,8 @@ optionsPairs opts = do return $ mkOptionList (zipWith mkOption [1 :: Int ..] opts) -- | Creates an 'OptionList' from a list of (display-value, internal value) pairs. +-- +-- @since 1.7.0 optionsPairsGrouped :: (MonadHandler m, RenderMessage (HandlerSite m) msg) => [(msg, [(msg, a)])] -> m (OptionList a) @@ -746,7 +756,7 @@ optionsPersist filts ords toDisplay = fmap mkOptionList $ do -- | An alternative to 'optionsPersist' which returns just the 'Key' instead of -- the entire 'Entity'. -- --- Since 1.3.2 +-- @since 1.3.2 #if MIN_VERSION_persistent(2,5,0) optionsPersistKey :: (YesodPersist site diff --git a/yesod-form/yesod-form.cabal b/yesod-form/yesod-form.cabal index c66cd7b0..1fb100b1 100644 --- a/yesod-form/yesod-form.cabal +++ b/yesod-form/yesod-form.cabal @@ -1,5 +1,5 @@ name: yesod-form -version: 1.6.7 +version: 1.7.0 license: MIT license-file: LICENSE author: Michael Snoyman