yesod-form 1.2.1 → 1.2.1.1
raw patch · 2 files changed
+12/−1 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Yesod/Form/Fields.hs +11/−0
- yesod-form.cabal +1/−1
Yesod/Form/Fields.hs view
@@ -60,6 +60,10 @@ import Text.Cassius import Data.Time (Day, TimeOfDay(..)) import qualified Text.Email.Validate as Email+#if MIN_VERSION_email_validate(1, 0, 0)+import Data.Text.Encoding (encodeUtf8, decodeUtf8With)+import Data.Text.Encoding.Error (lenientDecode)+#endif import Network.URI (parseURI) import Database.Persist (PersistField) import Database.Persist.Store (Entity (..))@@ -291,9 +295,16 @@ emailField :: RenderMessage master FormMessage => Field sub master Text emailField = Field { fieldParse = parseHelper $+#if MIN_VERSION_email_validate(1, 0, 0)+ \s ->+ case Email.canonicalizeEmail $ encodeUtf8 s of+ Just e -> Right $ decodeUtf8With lenientDecode e+ Nothing -> Left $ MsgInvalidEmail s+#else \s -> if Email.isValid (unpack s) then Right s else Left $ MsgInvalidEmail s+#endif , fieldView = \theId name attrs val isReq -> toWidget [hamlet| $newline never <input id="#{theId}" name="#{name}" *{attrs} type="email" :isReq:required="" value="#{either id id val}">
yesod-form.cabal view
@@ -1,5 +1,5 @@ name: yesod-form-version: 1.2.1+version: 1.2.1.1 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>