Introduce MenuType Footer; plumb footer.hamlet into defaultLinks

footer.hamlet now works much like navbar.hamlet
This commit is contained in:
Gregor Kleen 2019-01-26 12:44:22 +01:00
parent 12fd7f30f1
commit bad828aa07
2 changed files with 12 additions and 3 deletions

View File

@ -250,7 +250,7 @@ uniworxMessages :: [UniWorXMessage] -> UniWorXMessages
uniworxMessages = UniWorXMessages . map SomeMessage uniworxMessages = UniWorXMessages . map SomeMessage
-- Menus and Favourites -- Menus and Favourites
data MenuType = NavbarAside | NavbarRight | NavbarSecondary | PageActionPrime | PageActionSecondary data MenuType = NavbarAside | NavbarRight | NavbarSecondary | PageActionPrime | PageActionSecondary | Footer
deriving (Eq, Ord, Enum, Bounded, Read, Show, Generic) deriving (Eq, Ord, Enum, Bounded, Read, Show, Generic)
data MenuItem = MenuItem data MenuItem = MenuItem
@ -1068,7 +1068,7 @@ defaultLinks = fmap catMaybes . mapM runMaybeT $ -- Define the menu items of the
, menuItemAccessCallback' = return True , menuItemAccessCallback' = return True
} }
, return MenuItem , return MenuItem
{ menuItemType = NavbarRight { menuItemType = Footer
, menuItemLabel = MsgMenuVersion , menuItemLabel = MsgMenuVersion
, menuItemIcon = Just "book" , menuItemIcon = Just "book"
, menuItemRoute = SomeRoute VersionR , menuItemRoute = SomeRoute VersionR

View File

@ -1,3 +1,12 @@
<footer .footer> <footer .footer>
<div .footer-links> <div .footer-links>
<a href="/info">Impressum $forall (MenuItem{menuItemType, menuItemRoute = _, menuItemIcon = _, menuItemLabel, menuItemModal = _}, menuIdent, route) <- menuTypes
$case menuItemType
$of Footer
$# Not used but available (remove ` = _` from the pattern match above, as needed):
$# highlight (urlRoute menuItemRoute) :: Bool -- ^ Is this menu item currently active (i.e.: are we on this page)
$# menuItemModal :: Bool -- ^ Should this menu item open a modal instead of being a normal link
$# menuItemIcon :: Maybe Text -- ^ Should this menu item have an icon, if yes, then the name of the icon
<a href=#{route} ##{menuIdent}>
_{SomeMessage menuItemLabel}
$of _