Revert "EscapedHtml"

This reverts commit d7832b0535.
This commit is contained in:
Michael Snoyman 2010-09-20 07:26:34 +02:00
parent d7832b0535
commit b13c08f001
4 changed files with 2 additions and 34 deletions

View File

@ -9,7 +9,7 @@ module Yesod.Form.Class
import Text.Hamlet
import Yesod.Form.Fields
import Yesod.Form.Core
import Yesod.Form.Profiles (Textarea, EscapedHtml)
import Yesod.Form.Profiles (Textarea)
import Data.Int (Int64)
import Data.Time (Day, TimeOfDay)
@ -59,8 +59,3 @@ instance ToFormField Textarea y where
toFormField = textareaField
instance ToFormField (Maybe Textarea) y where
toFormField = maybeTextareaField
instance ToFormField EscapedHtml y where
toFormField = escapedHtmlField
instance ToFormField (Maybe EscapedHtml) y where
toFormField = maybeEscapedHtmlField

View File

@ -4,7 +4,6 @@ module Yesod.Form.Fields
-- ** Required
stringField
, textareaField
, escapedHtmlField
, hiddenField
, intField
, doubleField
@ -18,7 +17,6 @@ module Yesod.Form.Fields
-- ** Optional
, maybeStringField
, maybeTextareaField
, maybeEscapedHtmlField
, maybeHiddenField
, maybeIntField
, maybeDoubleField
@ -269,12 +267,6 @@ textareaField = requiredFieldHelper textareaFieldProfile
maybeTextareaField :: FormFieldSettings -> FormletField sub y (Maybe Textarea)
maybeTextareaField = optionalFieldHelper textareaFieldProfile
escapedHtmlField :: FormFieldSettings -> FormletField sub y EscapedHtml
escapedHtmlField = requiredFieldHelper escapedHtmlFieldProfile
maybeEscapedHtmlField :: FormFieldSettings -> FormletField sub y (Maybe EscapedHtml)
maybeEscapedHtmlField = optionalFieldHelper escapedHtmlFieldProfile
hiddenField :: FormFieldSettings -> FormletField sub y String
hiddenField = requiredFieldHelper hiddenFieldProfile

View File

@ -4,7 +4,6 @@
module Yesod.Form.Profiles
( stringFieldProfile
, textareaFieldProfile
, escapedHtmlFieldProfile
, hiddenFieldProfile
, intFieldProfile
, dayFieldProfile
@ -17,7 +16,6 @@ module Yesod.Form.Profiles
, parseDate
, parseTime
, Textarea (..)
, EscapedHtml (..)
) where
import Yesod.Form.Core
@ -112,23 +110,6 @@ textareaFieldProfile = FieldProfile
|]
}
-- | A newtype wrapper around a 'Html' that automatically entity-escapes all
-- input from the user. This means that values stored in the database are
-- already entity-escaped, avoiding escaping each time it is rendered.
newtype EscapedHtml = EscapedHtml { unEscapedHtml :: Html }
deriving (Show, Eq, PersistField)
instance ToHtml EscapedHtml where
toHtml = unEscapedHtml
escapedHtmlFieldProfile :: FieldProfile sub y EscapedHtml
escapedHtmlFieldProfile = FieldProfile
{ fpParse = Right . EscapedHtml . string
, fpRender = U.toString . renderHtml . unEscapedHtml
, fpWidget = \theId name val _isReq -> addBody [$hamlet|
%textarea#$theId$!name=$name$ $val$
|]
}
hiddenFieldProfile :: FieldProfile sub y String
hiddenFieldProfile = FieldProfile
{ fpParse = Right

View File

@ -1,5 +1,5 @@
name: yesod
version: 0.5.1
version: 0.5.0.4
license: BSD3
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>