packages feed

yesod-form 1.4.16 → 1.6.0

raw patch · 9 files changed

+52/−47 lines, 9 filesdep ~yesod-coredep ~yesod-persistent

Dependency ranges changed: yesod-core, yesod-persistent

Files

ChangeLog.md view
@@ -1,3 +1,7 @@+## 1.6.0++* Upgrade to yesod-core 1.6.0+ ## 1.4.16  * Korean translation
Yesod/Form/Bootstrap3.hs view
@@ -186,7 +186,7 @@   -- | (Internal) Render a help widget for tooltips and errors.-helpWidget :: FieldView site -> WidgetT site IO ()+helpWidget :: FieldView site -> WidgetFor site () helpWidget view = [whamlet|     $maybe tt <- fvTooltip view       <span .help-block>#{tt}
Yesod/Form/Fields.hs view
@@ -161,10 +161,9 @@     }   where showVal = either id (pack . show) --- | An alias for 'timeFieldTypeText'.+-- | An alias for 'timeFieldTypeTime'. timeField :: Monad m => RenderMessage (HandlerSite m) FormMessage => Field m TimeOfDay-timeField = timeFieldTypeText-{-# DEPRECATED timeField "'timeField' currently defaults to an input of type=\"text\". In the next major release, it will default to type=\"time\". To opt in to the new functionality, use 'timeFieldTypeTime'. To keep the existing behavior, use 'timeFieldTypeText'. See 'https://github.com/yesodweb/yesod/pull/874' for details." #-}+timeField = timeFieldTypeTime  -- | Creates an input with @type="time"@. <http://caniuse.com/#search=time%20input%20type Browsers not supporting this type> will fallback to a text field, and Yesod will parse the time as described in 'timeFieldTypeText'. -- @@ -175,6 +174,8 @@ timeFieldTypeTime = timeFieldOfType "time"  -- | Creates an input with @type="text"@, parsing the time from an [H]H:MM[:SS] format, with an optional AM or PM (if not given, AM is assumed for compatibility with the 24 hour clock system).+--+-- This function exists for backwards compatibility with the old implementation of 'timeField', which used to use @type="text"@. Consider using 'timeField' or 'timeFieldTypeTime' for improved UX and validation from the browser. --  -- Add the @time@ package and import the "Data.Time.LocalTime" module to use this function. --@@ -420,15 +421,15 @@ -- > areq (selectFieldList [("Value 1" :: Text, "value1"),("Value 2", "value2")]) "Which value?" Nothing selectFieldList :: (Eq a, RenderMessage site FormMessage, RenderMessage site msg)                 => [(msg, a)]-                -> Field (HandlerT site IO) a+                -> Field (HandlerFor site) a selectFieldList = selectField . optionsPairs  -- | Creates a @\<select>@ tag for selecting one option. Example usage: -- -- > areq (selectField $ optionsPairs [(MsgValue1, "value1"),(MsgValue2, "value2")]) "Which value?" Nothing selectField :: (Eq a, RenderMessage site FormMessage)-            => HandlerT site IO (OptionList a)-            -> Field (HandlerT site IO) a+            => HandlerFor site (OptionList a)+            -> Field (HandlerFor site) a selectField = selectFieldHelper     (\theId name attrs inside -> [whamlet| $newline never@@ -446,13 +447,13 @@ -- | Creates a @\<select>@ tag for selecting multiple options. multiSelectFieldList :: (Eq a, RenderMessage site msg)                      => [(msg, a)]-                     -> Field (HandlerT site IO) [a]+                     -> Field (HandlerFor site) [a] multiSelectFieldList = multiSelectField . optionsPairs  -- | Creates a @\<select>@ tag for selecting multiple options. multiSelectField :: Eq a-                 => HandlerT site IO (OptionList a)-                 -> Field (HandlerT site IO) [a]+                 => HandlerFor site (OptionList a)+                 -> Field (HandlerFor site) [a] multiSelectField ioptlist =     Field parse view UrlEncoded   where@@ -478,18 +479,18 @@ -- | Creates an input with @type="radio"@ for selecting one option. radioFieldList :: (Eq a, RenderMessage site FormMessage, RenderMessage site msg)                => [(msg, a)]-               -> Field (HandlerT site IO) a+               -> Field (HandlerFor site) a radioFieldList = radioField . optionsPairs  -- | Creates an input with @type="checkbox"@ for selecting multiple options. checkboxesFieldList :: (Eq a, RenderMessage site msg) => [(msg, a)]-                     -> Field (HandlerT site IO) [a]+                     -> Field (HandlerFor site) [a] checkboxesFieldList = checkboxesField . optionsPairs  -- | Creates an input with @type="checkbox"@ for selecting multiple options. checkboxesField :: Eq a-                 => HandlerT site IO (OptionList a)-                 -> Field (HandlerT site IO) [a]+                 => HandlerFor site (OptionList a)+                 -> Field (HandlerFor site) [a] checkboxesField ioptlist = (multiSelectField ioptlist)     { fieldView =         \theId name attrs val _isReq -> do@@ -506,8 +507,8 @@     } -- | Creates an input with @type="radio"@ for selecting one option. radioField :: (Eq a, RenderMessage site FormMessage)-           => HandlerT site IO (OptionList a)-           -> Field (HandlerT site IO) a+           => HandlerFor site (OptionList a)+           -> Field (HandlerFor site) a radioField = selectFieldHelper     (\theId _name _attrs inside -> [whamlet| $newline never@@ -663,7 +664,7 @@                => [Filter a]                -> [SelectOpt a]                -> (a -> msg)-               -> HandlerT site IO (OptionList (Entity a))+               -> HandlerFor site (OptionList (Entity a)) #else optionsPersist :: ( YesodPersist site, PersistEntity a                   , PersistQuery (PersistEntityBackend a)@@ -674,7 +675,7 @@                => [Filter a]                -> [SelectOpt a]                -> (a -> msg)-               -> HandlerT site IO (OptionList (Entity a))+               -> HandlerFor site (OptionList (Entity a)) #endif optionsPersist filts ords toDisplay = fmap mkOptionList $ do     mr <- getMessageRender@@ -701,7 +702,7 @@   => [Filter a]   -> [SelectOpt a]   -> (a -> msg)-  -> HandlerT site IO (OptionList (Key a))+  -> HandlerFor site (OptionList (Key a)) #else optionsPersistKey   :: (YesodPersist site@@ -714,7 +715,7 @@   => [Filter a]   -> [SelectOpt a]   -> (a -> msg)-  -> HandlerT site IO (OptionList (Key a))+  -> HandlerFor site (OptionList (Key a)) #endif  optionsPersistKey filts ords toDisplay = fmap mkOptionList $ do@@ -728,11 +729,11 @@  selectFieldHelper         :: (Eq a, RenderMessage site FormMessage)-        => (Text -> Text -> [(Text, Text)] -> WidgetT site IO () -> WidgetT site IO ())-        -> (Text -> Text -> Bool -> WidgetT site IO ())-        -> (Text -> Text -> [(Text, Text)] -> Text -> Bool -> Text -> WidgetT site IO ())-        -> HandlerT site IO (OptionList a)-        -> Field (HandlerT site IO) a+        => (Text -> Text -> [(Text, Text)] -> WidgetFor site () -> WidgetFor site ())+        -> (Text -> Text -> Bool -> WidgetFor site ())+        -> (Text -> Text -> [(Text, Text)] -> Text -> Bool -> Text -> WidgetFor site ())+        -> HandlerFor site (OptionList a)+        -> Field (HandlerFor site) a selectFieldHelper outside onOpt inside opts' = Field     { fieldParse = \x _ -> do         opts <- opts'
Yesod/Form/Functions.hs view
@@ -385,8 +385,8 @@ identifyForm   :: Monad m   => Text -- ^ Form identification string.-  -> (Html -> MForm m (FormResult a, WidgetT (HandlerSite m) IO ()))-  -> (Html -> MForm m (FormResult a, WidgetT (HandlerSite m) IO ()))+  -> (Html -> MForm m (FormResult a, WidgetFor (HandlerSite m) ()))+  -> (Html -> MForm m (FormResult a, WidgetFor (HandlerSite m) ())) identifyForm identVal form = \fragment -> do     -- Create hidden <input>.     let fragment' =@@ -418,7 +418,7 @@ type FormRender m a =        AForm m a     -> Html-    -> MForm m (FormResult a, WidgetT (HandlerSite m) IO ())+    -> MForm m (FormResult a, WidgetFor (HandlerSite m) ())  renderTable, renderDivs, renderDivsNoLabels :: Monad m => FormRender m a -- | Render a form into a series of tr tags. Note that, in order to allow
Yesod/Form/Jquery.hs view
@@ -53,16 +53,16 @@     urlJqueryUiDateTimePicker :: a -> Either (Route a) Text     urlJqueryUiDateTimePicker _ = Right "http://github.com/gregwebs/jquery.ui.datetimepicker/raw/master/jquery.ui.datetimepicker.js" -jqueryDayField :: (RenderMessage site FormMessage, YesodJquery site) => JqueryDaySettings -> Field (HandlerT site IO) Day+jqueryDayField :: (RenderMessage site FormMessage, YesodJquery site) => JqueryDaySettings -> Field (HandlerFor site) Day jqueryDayField = flip jqueryDayField' "date"  -- | Use jQuery's datepicker as the underlying implementation. -- -- Since 1.4.3-jqueryDatePickerDayField :: (RenderMessage site FormMessage, YesodJquery site) => JqueryDaySettings -> Field (HandlerT site IO) Day+jqueryDatePickerDayField :: (RenderMessage site FormMessage, YesodJquery site) => JqueryDaySettings -> Field (HandlerFor site) Day jqueryDatePickerDayField = flip jqueryDayField' "text" -jqueryDayField' :: (RenderMessage site FormMessage, YesodJquery site) => JqueryDaySettings -> Text -> Field (HandlerT site IO) Day+jqueryDayField' :: (RenderMessage site FormMessage, YesodJquery site) => JqueryDaySettings -> Text -> Field (HandlerFor site) Day jqueryDayField' jds inputType = Field     { fieldParse = parseHelper $ maybe                   (Left MsgInvalidDay)@@ -107,13 +107,13 @@         ]  jqueryAutocompleteField :: (RenderMessage site FormMessage, YesodJquery site)-                        => Route site -> Field (HandlerT site IO) Text+                        => Route site -> Field (HandlerFor site) Text jqueryAutocompleteField = jqueryAutocompleteField' 2  jqueryAutocompleteField' :: (RenderMessage site FormMessage, YesodJquery site)                          => Int -- ^ autocomplete minimum length                          -> Route site-                         -> Field (HandlerT site IO) Text+                         -> Field (HandlerFor site) Text jqueryAutocompleteField' minLen src = Field     { fieldParse = parseHelper $ Right     , fieldView = \theId name attrs val isReq -> do
Yesod/Form/MassInput.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TypeFamilies #-} {-# 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@@ -44,17 +44,17 @@  -- | Generate a form that accepts 0 or more values from the user, allowing the -- user to specify that a new row is necessary.-inputList :: (xml ~ WidgetT site IO (), RenderMessage site FormMessage)+inputList :: (xml ~ WidgetFor site (), RenderMessage site FormMessage)           => Html           -- ^ label for the form           -> ([[FieldView site]] -> xml)           -- ^ how to display the rows, usually either 'massDivs' or 'massTable'-          -> (Maybe a -> AForm (HandlerT site IO) a)+          -> (Maybe a -> AForm (HandlerFor site) 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]+          -> AForm (HandlerFor site) [a] inputList label fixXml single mdef = formToAForm $ do     theId <- lift newIdent     down 1@@ -94,9 +94,9 @@         , fvRequired = False         }]) -withDelete :: (xml ~ WidgetT site IO (), RenderMessage site FormMessage)-           => AForm (HandlerT site IO) a-           -> MForm (HandlerT site IO) (Either xml (FormResult a, [FieldView site]))+withDelete :: (xml ~ WidgetFor site (), RenderMessage site FormMessage)+           => AForm (HandlerFor site) a+           -> MForm (HandlerFor site) (Either xml (FormResult a, [FieldView site])) withDelete af = do     down 1     deleteName <- newFormIdent@@ -129,7 +129,7 @@  massDivs, massTable          :: [[FieldView site]]-         -> WidgetT site IO ()+         -> WidgetFor site () massDivs viewss = [whamlet| $newline never $forall views <- viewss
Yesod/Form/Nic.hs view
@@ -29,7 +29,7 @@     urlNicEdit :: a -> Either (Route a) Text     urlNicEdit _ = Right "http://js.nicedit.com/nicEdit-latest.js" -nicHtmlField :: YesodNic site => Field (HandlerT site IO) Html+nicHtmlField :: YesodNic site => Field (HandlerFor site) Html nicHtmlField = Field     { fieldParse = \e _ -> return . Right . fmap (preEscapedToMarkup . sanitizeBalance) . listToMaybe $ e     , fieldView = \theId name attrs val _isReq -> do
Yesod/Form/Types.hs view
@@ -189,7 +189,7 @@     { fvLabel :: Html     , fvTooltip :: Maybe Html     , fvId :: Text-    , fvInput :: WidgetT site IO ()+    , fvInput :: WidgetFor site ()     , fvErrors :: Maybe Html     , fvRequired :: Bool     }@@ -200,7 +200,7 @@    -> [(Text, Text)] -- ^ Attributes    -> Either Text a -- ^ Either (invalid text) or (legitimate result)    -> Bool -- ^ Required?-   -> WidgetT (HandlerSite m) IO ()+   -> WidgetFor (HandlerSite m) ()  data Field m a = Field     { fieldParse :: [Text] -> [FileInfo] -> m (Either (SomeMessage (HandlerSite m)) (Maybe a))
yesod-form.cabal view
@@ -1,5 +1,5 @@ name:            yesod-form-version:         1.4.16+version:         1.6.0 license:         MIT license-file:    LICENSE author:          Michael Snoyman <michael@snoyman.com>@@ -20,8 +20,8 @@  library     build-depends:   base                  >= 4        && < 5-                   , yesod-core            >= 1.4.14   && < 1.5-                   , yesod-persistent      >= 1.4      && < 1.5+                   , yesod-core            >= 1.6      && < 1.7+                   , yesod-persistent      >= 1.6      && < 1.7                    , time                  >= 1.1.4                    , shakespeare           >= 2.0                    , persistent