Introduce pageHeading function

This commit is contained in:
Gregor Kleen 2018-06-07 11:26:41 +02:00 committed by Felix Hamann
parent 0d2c5696c5
commit f4b6d1e3f5
3 changed files with 13 additions and 4 deletions

View File

@ -49,3 +49,4 @@ SubmissionAlreadyExistsFor user@Text: #{user} hat bereits eine Abgabe zu diesem
EMailUnknown email@Text: E-Mail #{email} gehört zu keinem bekannten Benutzer.
NotAParticipant user@Text tid@TermIdentifier csh@Text: #{user} ist nicht im Kurs #{termToText tid}-#{csh} angemeldet.
HomeHeading: Startseite

View File

@ -434,13 +434,14 @@ instance Yesod UniWorX where
-- value passed to hamletToRepHtml cannot be a widget, this allows
-- you to use normal widget features in default-layout.
let
navbar :: Widget
navbar = $(widgetFile "widgets/navbar")
asidenav :: Widget
asidenav = $(widgetFile "widgets/asidenav")
contentHeadline :: Maybe String
contentHeadline = Just "Some Headline" -- should be coming from the currently viewed page
contentHeadline :: Maybe Widget
contentHeadline = pageHeading =<< mcurrentRoute
breadcrumbs :: Widget
breadcrumbs = $(widgetFile "widgets/breadcrumbs")
pageactionprime :: Widget
@ -686,6 +687,12 @@ pageActions (TermCourseListR _) =
pageActions _ = []
pageHeading :: Route UniWorx -> Maybe Widget
pageHeading HomeR
= Just [whamlet|_{MsgHomeHeading}|]
pageHeading _
= Nothing
defaultLinks :: [MenuTypes]
defaultLinks = -- Define the menu items of the header.
[ NavbarRight $ MenuItem

View File

@ -14,8 +14,9 @@
<div class="alert alert-#{status2}">#{msg}
<!-- workaround for pageactionprime not visible inside of ^{widget}. see terms.hamlet-->
<h1>
#{fromMaybe "default headline" contentHeadline}
$maybe headline <- contentHeadline
<h1>
^{headline}
<!-- maybe #{pageTitle pc} ? -->
<!-- prime page actions -->