Enable breadcrumbs for EntriesR and EntryR
This commit is contained in:
parent
934457f671
commit
c554715df7
1 changed files with 5 additions and 1 deletions
|
@ -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.
|
||||||
|
|
Loading…
Reference in a new issue