on master help sign in
Add a link to the root of the tree. fpco/libraries#72
commitfd436437f88668f17dc8e1bbbb8f3e1eed287b5a authorDan Burton <danburton.email@gmail.com> dateThu 30 Apr 2015, 13:40 (11 years ago) parent8c4bd50
1 file changed+6−2
wai-app-static/WaiAppStatic/Listing.hs+6−2
wai-app-static/WaiAppStatic/Listing.hs+6−2
@@ -48,7 +48,7 @@ defaultListing pieces (Folder contents) = do
4848 , "a { text-decoration: none }"
4949 ]
5050 H.body $ do
51− H.h1 $ showFolder $ filter (not . T.null . fromPiece) pieces
51+ H.h1 $ showFolder' $ filter (not . T.null . fromPiece) pieces
5252 renderDirectoryContentsTable haskellSrc folderSrc fps''
5353 where
5454 image x = T.unpack $ T.concat [(relativeDirFromPieces pieces), ".hidden/", x, ".png"]
@@ -57,8 +57,12 @@ defaultListing pieces (Folder contents) = do
5757 showName "" = "root"
5858 showName x = x
5959
60+ -- Add a link to the root of the tree
61+ showFolder' :: Pieces -> H.Html
62+ showFolder' pieces = showFolder (unsafeToPiece "root" : pieces)
63+
6064 showFolder :: Pieces -> H.Html
61− showFolder [] = "/"
65+ showFolder [] = "/" -- won't happen
6266 showFolder [x] = H.toHtml $ showName $ fromPiece x
6367 showFolder (x:xs) = do
6468 let href = concat $ replicate (length xs) "../" :: String