Ported Yesod.Helpers.Crud to work with 0.7.x and added to exported modules. I think this is desirable since none of the other modules export its functionality.

This commit is contained in:
Ian Duncan 2011-02-19 19:18:03 -06:00
parent 8a97f4fe11
commit ec911c2b58
2 changed files with 8 additions and 5 deletions

View File

@ -12,7 +12,8 @@ module Yesod.Helpers.Crud
, defaultCrud
) where
import Yesod.Yesod
-- import Yesod
import Yesod.Core
import Yesod.Widget
import Yesod.Dispatch
import Yesod.Content
@ -20,7 +21,7 @@ import Yesod.Handler
import Text.Hamlet
import Yesod.Form
import Language.Haskell.TH.Syntax
import Yesod.Persist
-- | An entity which can be displayed by the Crud subsite.
class Item a where
-- | The title of an entity, to be displayed in the list of all entities.
@ -137,7 +138,7 @@ getCrudDeleteR s = do
<p>Do you really want to delete #{itemTitle item}?
<p>
<input type="submit" value="Yes">
\
\
<a href="@{toMaster CrudListR}">No
|]
@ -190,13 +191,13 @@ crudHelper title me isPost = do
\#{hidden}
<input type="submit">
$maybe e <- me
\
\
<a href="@{toMaster (CrudDeleteR (toSinglePiece (fst e)))}">Delete
|]
-- | A default 'Crud' value which relies about persistent and "Yesod.Form".
defaultCrud
:: (PersistEntity i, PersistBackend (YesodDB a (GHandler (Crud a i) a)),
:: (PersistEntity i, PersistBackend (YesodDB a (GGHandler (Crud a i) a IO)),
YesodPersist a)
=> a -> Crud a i
defaultCrud = const Crud

View File

@ -16,6 +16,7 @@ library
, yesod-core >= 0.7 && < 0.8
, time >= 1.1.4 && < 1.3
, hamlet >= 0.7 && < 0.8
, yesod-persistent >= 0.0.0.0 && < 0.0.1
, persistent >= 0.4 && < 0.5
, template-haskell
, transformers >= 0.2.2 && < 0.3
@ -33,6 +34,7 @@ library
Yesod.Form.Jquery
Yesod.Form.Nic
Yesod.Form.Profiles
Yesod.Helpers.Crud
ghc-options: -Wall
source-repository head