From 7cb7a79660185c2a07b1b88c830f2e3be289cbd9 Mon Sep 17 00:00:00 2001 From: Artyom Date: Sun, 20 Mar 2016 13:30:10 +0300 Subject: [PATCH] Add anchor links to items --- src/Main.hs | 2 -- src/View.hs | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Main.hs b/src/Main.hs index b3db3eb..d0d5833 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -286,8 +286,6 @@ itemToFeedEntry baseUrl category item = (Atom.TextString (T.unpack (item^.name))) (Feed.toFeedDateStringUTC Feed.AtomKind (item^.created)) --- TODO: add # links to items - main :: IO () main = do let emptyState = GlobalState mempty diff --git a/src/View.hs b/src/View.hs index 4f26430..2f18874 100644 --- a/src/View.hs +++ b/src/View.hs @@ -322,7 +322,7 @@ getItemHue category item = case item^.group_ of -- instead of using arrows? Touch Punch works on mobile, too renderItem :: Category -> Item -> HtmlT IO () renderItem category item = - -- The id is used for links in feeds + -- The id is used for links in feeds, and for anchor links div_ [id_ ("item-" <> uidToText (item^.uid)), class_ "item"] $ do renderItemInfo category item -- TODO: replace “edit description” with a big half-transparent pencil @@ -386,6 +386,9 @@ renderItemInfo cat item = do section "normal" [shown, noScriptShown] $ do -- TODO: [very-easy] move this style_ into css.css span_ [style_ "font-size:150%"] $ do + -- TODO: absolute links again [absolute-links] + let link' = format "/haskell/{}#item-{}" (categorySlug cat, item^.uid) + a_ [class_ "anchor", href_ link'] "#" renderItemHeader item emptySpan "2em" toHtml (fromMaybe "other" (item^.group_))