Enable breadcrumbs for EntriesR and EntryR

This commit is contained in:
Danielle McLean 2017-10-09 10:03:03 +11:00
parent 934457f671
commit c554715df7
Signed by: 00dani
GPG key ID: 5A5D2D1AFF12EEC5

View file

@ -21,7 +21,7 @@ import Yesod.Core.Types (Logger)
import qualified Yesod.Core.Unsafe as Unsafe import qualified Yesod.Core.Unsafe as Unsafe
import Package import Package
import Entry.Kind ( EntryKind ) import Entry.Kind ( EntryKind, pluralise )
-- | The foundation datatype for your application. This can be a good place to -- | The foundation datatype for your application. This can be a good place to
-- keep settings and values requiring initialization before your application -- keep settings and values requiring initialization before your application
@ -158,6 +158,10 @@ rightMenuItems = loggedOutItems `maybe` loggedInItems
-- Define breadcrumbs. -- Define breadcrumbs.
instance YesodBreadcrumbs App where instance YesodBreadcrumbs App where
breadcrumb (AuthR _) = return ("login", Just HomeR) breadcrumb (AuthR _) = return ("login", Just HomeR)
breadcrumb (EntriesR kind) = return (pluralise kind, Just HomeR)
breadcrumb (EntryR kind entryId _) = do
entry <- runDB . get404 $ entryId
return (entryName entry, Just $ EntriesR kind)
breadcrumb _ = return ("home", Nothing) breadcrumb _ = return ("home", Nothing)
-- How to run database actions. -- How to run database actions.