diff --git a/src/Vervis/Foundation.hs b/src/Vervis/Foundation.hs index 0ba0a9c..b355b98 100644 --- a/src/Vervis/Foundation.hs +++ b/src/Vervis/Foundation.hs @@ -17,7 +17,6 @@ module Vervis.Foundation where import Prelude (init, last) -import Vervis.Import.NoFoundation hiding (last) import Database.Persist.Sql (ConnectionPool, runSqlPool) import Text.Hamlet (hamletFile) import Text.Jasmine (minifym) @@ -31,6 +30,9 @@ import qualified Yesod.Core.Unsafe as Unsafe import Data.Text as T (pack) --import qualified Data.Text.Encoding as TE +import Vervis.Import.NoFoundation hiding (last) +import Vervis.Widget (breadcrumbBar) + -- | The foundation datatype for your application. This can be a good place to -- keep settings and values requiring initialization before your application -- starts running, such as database connections. Every handler will have diff --git a/src/Vervis/Widget.hs b/src/Vervis/Widget.hs new file mode 100644 index 0000000..a141581 --- /dev/null +++ b/src/Vervis/Widget.hs @@ -0,0 +1,33 @@ +{- This file is part of Vervis. + - + - Written in 2016 by fr33domlover . + - + - ♡ Copying is an act of love. Please copy, reuse and share. + - + - The author(s) have dedicated all copyright and related and neighboring + - rights to this software to the public domain worldwide. This software is + - distributed without any warranty. + - + - You should have received a copy of the CC0 Public Domain Dedication along + - with this software. If not, see + - . + -} + +-- | Various custom widgets. +module Vervis.Widget + ( breadcrumbBar + ) +where + +import Prelude + +import Yesod.Core (YesodBreadcrumbs, breadcrumbs) +import Yesod.Core.Widget + +import Vervis.Settings (widgetFile) +import Vervis.Style + +breadcrumbBar :: YesodBreadcrumbs site => WidgetT site IO () +breadcrumbBar = do + (current, bcs) <- handlerToWidget breadcrumbs + $(widgetFile "breadcrumbs") diff --git a/templates/breadcrumbs.cassius b/templates/breadcrumbs.cassius new file mode 100644 index 0000000..e58d0bf --- /dev/null +++ b/templates/breadcrumbs.cassius @@ -0,0 +1,22 @@ +/* This file is part of Vervis. + * + * Written in 2016 by fr33domlover . + * + * ♡ Copying is an act of love. Please copy, reuse and share. + * + * The author(s) have dedicated all copyright and related and neighboring + * rights to this software to the public domain worldwide. This software is + * distributed without any warranty. + * + * You should have received a copy of the CC0 Public Domain Dedication along + * with this software. If not, see + * . + */ + +.parents + color: #{dark yellow} + font: 160% monospace + +.title + color: #{dark yellow} + font: 160% monospace diff --git a/templates/breadcrumbs.hamlet b/templates/breadcrumbs.hamlet new file mode 100644 index 0000000..794c7e7 --- /dev/null +++ b/templates/breadcrumbs.hamlet @@ -0,0 +1,20 @@ +$# This file is part of Vervis. +$# +$# Written in 2016 by fr33domlover . +$# +$# ♡ Copying is an act of love. Please copy, reuse and share. +$# +$# The author(s) have dedicated all copyright and related and neighboring +$# rights to this software to the public domain worldwide. This software is +$# distributed without any warranty. +$# +$# You should have received a copy of the CC0 Public Domain Dedication along +$# with this software. If not, see +$# . + + + $forall (route, title) <- bcs + #{title} + :: # + + #{current} diff --git a/templates/default-layout.hamlet b/templates/default-layout.hamlet index e4080c2..08908ee 100644 --- a/templates/default-layout.hamlet +++ b/templates/default-layout.hamlet @@ -13,14 +13,17 @@ $# with this software. If not, see $# . $maybe Entity _pid person <- mperson -

+