From 2e9efc678a740a3d0e7a4afaa5e2e9d85586605b Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 6 Jul 2010 20:08:02 +0000 Subject: [PATCH] webyesod: make current navigation link bold --- Hledger/Cli/Commands/Web.hs | 16 +++++++++------- data/web/style.css | 3 ++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Hledger/Cli/Commands/Web.hs b/Hledger/Cli/Commands/Web.hs index 71645d964..51a9ecdd7 100644 --- a/Hledger/Cli/Commands/Web.hs +++ b/Hledger/Cli/Commands/Web.hs @@ -158,22 +158,24 @@ navbar here a p = [$hamlet| ^navlinks'^ ^searchform'^ |] - where navlinks' = navlinks a p + where navlinks' = navlinks here a p searchform' = searchform here a p -navlinks :: String -> String -> Hamlet HledgerWebAppRoutes -navlinks a p = [$hamlet| +navlinks :: HledgerWebAppRoutes -> String -> String -> Hamlet HledgerWebAppRoutes +navlinks here a p = [$hamlet| #navlinks ^transactionslink^ | $ ^registerlink^ | $ ^balancelink^ |] where - transactionslink = navlink "transactions" TransactionsPage - registerlink = navlink "register" RegisterPage - balancelink = navlink "balance" BalancePage - navlink s dest = [$hamlet|%a.navlink!href=@?u@ $string.s$|] + transactionslink = navlink here "transactions" TransactionsPage + registerlink = navlink here "register" RegisterPage + balancelink = navlink here "balance" BalancePage + navlink here s dest = [$hamlet|%a.$style$!href=@?u@ $string.s$|] where u = (dest, [("a", a), ("p", p)]) + style | here == dest = string "navlinkcurrent" + | otherwise = string "navlink" searchform :: HledgerWebAppRoutes -> String -> String -> Hamlet HledgerWebAppRoutes searchform here a p = [$hamlet| diff --git a/data/web/style.css b/data/web/style.css index 56938cd4a..ef0618a01 100644 --- a/data/web/style.css +++ b/data/web/style.css @@ -3,7 +3,8 @@ body { font-family: "helvetica","arial", "sans serif"; margin:0; } #navbar { background-color:#eeeeee; border-bottom:2px solid #dddddd; padding:4px 4px 6px 4px; } #navlinks { display:inline; } -.navlink { font-weight:normal; } +.navlink { } +.navlinkcurrent { font-weight:bold; } #searchform { font-size:small; display:inline; margin-left:1em; } #resetlink { font-size:small; } .toprightlink { font-size:small; margin-left:1em; float:right; }