Minor fixes
This commit is contained in:
parent
8ba59eac43
commit
ad12ce63f0
@ -43,7 +43,7 @@ library
|
|||||||
, persistent >= 0.7 && < 0.8
|
, persistent >= 0.7 && < 0.8
|
||||||
, persistent-template >= 0.7 && < 0.8
|
, persistent-template >= 0.7 && < 0.8
|
||||||
, SHA >= 1.4.1.3 && < 1.6
|
, SHA >= 1.4.1.3 && < 1.6
|
||||||
, http-conduit >= 1.0 && < 1.1
|
, http-conduit >= 1.1 && < 1.2
|
||||||
, aeson >= 0.5
|
, aeson >= 0.5
|
||||||
, pwstore-fast >= 2.2 && < 3
|
, pwstore-fast >= 2.2 && < 3
|
||||||
|
|
||||||
|
|||||||
@ -53,6 +53,7 @@ import Data.Time (Day, TimeOfDay(..))
|
|||||||
import qualified Text.Email.Validate as Email
|
import qualified Text.Email.Validate as Email
|
||||||
import Network.URI (parseURI)
|
import Network.URI (parseURI)
|
||||||
import Database.Persist (PersistField)
|
import Database.Persist (PersistField)
|
||||||
|
import Database.Persist.Query (Entity (..))
|
||||||
import Text.HTML.SanitizeXSS (sanitizeBalance)
|
import Text.HTML.SanitizeXSS (sanitizeBalance)
|
||||||
import Control.Monad (when, unless)
|
import Control.Monad (when, unless)
|
||||||
import Data.List (intersect, nub)
|
import Data.List (intersect, nub)
|
||||||
@ -414,12 +415,12 @@ optionsPersist :: ( YesodPersist master, PersistEntity a
|
|||||||
, PersistQuery (YesodPersistBackend master) (GHandler sub master)
|
, PersistQuery (YesodPersistBackend master) (GHandler sub master)
|
||||||
, PathPiece (Key (YesodPersistBackend master) a)
|
, PathPiece (Key (YesodPersistBackend master) a)
|
||||||
)
|
)
|
||||||
=> [Filter a] -> [SelectOpt a] -> (a -> Text) -> GHandler sub master (OptionList (Key (YesodPersistBackend master) a, a))
|
=> [Filter a] -> [SelectOpt a] -> (a -> Text) -> GHandler sub master (OptionList (Entity (YesodPersistBackend master) a))
|
||||||
optionsPersist filts ords toDisplay = fmap mkOptionList $ do
|
optionsPersist filts ords toDisplay = fmap mkOptionList $ do
|
||||||
pairs <- runDB $ selectList filts ords
|
pairs <- runDB $ selectList filts ords
|
||||||
return $ map (\(key, value) -> Option
|
return $ map (\(Entity key value) -> Option
|
||||||
{ optionDisplay = toDisplay value
|
{ optionDisplay = toDisplay value
|
||||||
, optionInternalValue = (key, value)
|
, optionInternalValue = Entity key value
|
||||||
, optionExternalValue = toPathPiece key
|
, optionExternalValue = toPathPiece key
|
||||||
}) pairs
|
}) pairs
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user