Yesod-admin-crud is a project mainly written in Haskell, based on the BSD-3-Clause license.
Admin CRUD interface for the yesod web framework
Admin CRUD "sub-site" for the Yesod web framework.
CRUD means Create, Read, Update, Delete. This module provides access to the site's database for an admin user.
Instructions of how to add the sub-site to Yesod's scaffolded website:
Add to config/routes
/admin AdminR Admin getAdmin
The site's foundation type needs to be moved out of Foundation.hs
as it will be needed by Model.hs
.
Not moving the type to separate module will cause an import cycle.
In Model.hs
, change
share [mkPersist sqlSettings, mkMigrate "migrateAll"] $(persistFile "config/models")
to
share [mkPersist sqlSettings, mkMigrate "migrateAll", mkYesodAdmin ''SoundRadix] $(persistFile "config/models")
(Added , mkYesodAdmin ''SoundRadix
)
In Foundation.hs
, add
instance YesodAdminUser SoundRadix where
isAdminUser = return True
isAdminUser
to determine whether the logged-in user is an administrator user or not.YesodAdminUser
is exported by Yesod.Admin.User
.The changes describe above require several imports and language extensions. These should be simple to solve.