From 39270bd7887f31c125c051caaf80f032c087bd9b Mon Sep 17 00:00:00 2001 From: SJost Date: Thu, 6 Sep 2018 17:06:36 +0200 Subject: [PATCH] First try for #174, needs more thinking though, see issue. --- src/Utils.hs | 10 ++++++++++ templates/default-layout.hamlet | 2 ++ templates/widgets/pageactionprime.hamlet | 3 --- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Utils.hs b/src/Utils.hs index e472e72ca..7bef82270 100644 --- a/src/Utils.hs +++ b/src/Utils.hs @@ -27,6 +27,7 @@ import Utils.PathPiece as Utils import Text.Blaze (Markup, ToMarkup) +import Control.Lens import Data.Set (Set) import qualified Data.Set as Set import Data.Map (Map) @@ -174,6 +175,15 @@ trd3 (_,_,z) = z -- notNull = not . null +lastMaybe :: [a] -> Maybe a +lastMaybe [] = Nothing +lastMaybe [h] = Just h +lastMaybe (_:t) = lastMaybe t + +lastMaybe' :: [a] -> Maybe a +lastMaybe' l = fmap snd $ l ^? _Snoc + + mergeAttrs :: [(Text, Text)] -> [(Text, Text)] -> [(Text, Text)] mergeAttrs = mergeAttrs' `on` sort where diff --git a/templates/default-layout.hamlet b/templates/default-layout.hamlet index 87827d44f..4d4b024ac 100644 --- a/templates/default-layout.hamlet +++ b/templates/default-layout.hamlet @@ -15,6 +15,8 @@

+ $maybe back <- lastMaybe parents + #{snd back} $maybe headline <- contentHeadline ^{headline} $nothing diff --git a/templates/widgets/pageactionprime.hamlet b/templates/widgets/pageactionprime.hamlet index b12d7ae24..cce7e13e3 100644 --- a/templates/widgets/pageactionprime.hamlet +++ b/templates/widgets/pageactionprime.hamlet @@ -7,9 +7,6 @@ $if hasPageActions $of PageActionPrime (MenuItem label _mIcon route _callback)
  • #{label} - $of _ - $forall menuType <- menuTypes - $case menuType $of PageActionSecondary (MenuItem label _mIcon route _callback)
  • #{label}