From 262a5dca2b00945d0d520d3d31164ed237c9e037 Mon Sep 17 00:00:00 2001 From: SJost Date: Wed, 29 Aug 2018 16:49:57 +0200 Subject: [PATCH] PageAction 'last breadcrumb' not needed as shown in PageActions for SCorrR linking to SEditR --- src/Foundation.hs | 20 +++++++++++++------- templates/widgets/pageactionprime.hamlet | 8 +++++++- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/Foundation.hs b/src/Foundation.hs index 1144412ec..839a5f4e5 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -161,7 +161,7 @@ data MenuTypes -- Semantische Rolle: | NavbarRight { menuItem :: MenuItem } -- Generell, nahezu immer sichtbar | NavbarSecondary { menuItem :: MenuItem } -- Generell, nahezu immer sichtbar | PageActionPrime { menuItem :: MenuItem } -- Seitenspezifische Aktion, häufig - | PageActionSecondary { menuItem :: MenuItem } -- Seitenspezifische Aktion, selten + | PageActionSecondary { menuItem :: MenuItem } -- Seitenspezifische Aktion, selten (nicht im MouseOver enthalten, immer hinten gelistet) -- Messages mkMessage "UniWorX" "messages/uniworx" "de" @@ -529,9 +529,7 @@ instance Yesod UniWorX where -- let isParent :: Route UniWorX -> Bool -- isParent r = r == (fst parents) - - let - menu = defaultLinks ++ maybe [] pageActions mcurrentRoute + let menu = defaultLinks ++ maybe [] pageActions mcurrentRoute menuTypes <- filterM (menuItemAccessCallback . menuItem) menu @@ -581,10 +579,11 @@ instance Yesod UniWorX where breadcrumbs :: Widget breadcrumbs = $(widgetFile "widgets/breadcrumbs") pageactionprime :: Widget - pageactionprime = $(widgetFile "widgets/pageactionprime") - -- functions to determine if there are page-actions + pageactionprime = $(widgetFile "widgets/pageactionprime") -- TODO: rename, since it also shows secondary pageActions now + -- functions to determine if there are page-actions (primary or secondary) isPageActionPrime :: MenuTypes -> Bool - isPageActionPrime (PageActionPrime _) = True + isPageActionPrime (PageActionPrime _) = True + isPageActionPrime (PageActionSecondary _) = True isPageActionPrime _ = False hasPageActions :: Bool hasPageActions = any isPageActionPrime menuTypes @@ -772,6 +771,7 @@ defaultLinks = -- Define the menu items of the header. } ] + pageActions :: Route UniWorX -> [MenuTypes] {- Icons: https://fontawesome.com/icons?d=gallery @@ -940,6 +940,12 @@ pageActions (CSheetR tid ssh csh shn SCorrR) = , menuItemRoute = CSheetR tid ssh csh shn SSubsR , menuItemAccessCallback' = return True } + , PageActionSecondary $ MenuItem + { menuItemLabel = "Edit " <> (CI.original shn) + , menuItemIcon = Nothing + , menuItemRoute = CSheetR tid ssh csh shn SEditR + , menuItemAccessCallback' = return True + } ] pageActions (CorrectionsR) = [ PageActionPrime $ MenuItem diff --git a/templates/widgets/pageactionprime.hamlet b/templates/widgets/pageactionprime.hamlet index 2c828a4fa..b12d7ae24 100644 --- a/templates/widgets/pageactionprime.hamlet +++ b/templates/widgets/pageactionprime.hamlet @@ -4,7 +4,13 @@ $if hasPageActions