1
1
mirror of https://github.com/aelve/guide.git synced 2024-11-26 03:08:37 +03:00

Add category status banner for WIP/stub categories

This commit is contained in:
Aaron Friel 2017-01-29 16:39:05 -06:00
parent ee0610b396
commit 52fa345836
2 changed files with 23 additions and 1 deletions

View File

@ -41,9 +41,9 @@ module Guide.View
)
where
import Imports
-- Lists
import Data.List.Split
-- Containers
@ -722,6 +722,21 @@ renderSearchResults cats = do
a_ [class_ "category-link", href_ (categoryLink category)] $
toHtml (category^.title)
renderCategoryStatus :: MonadIO m => Category -> HtmlT m ()
renderCategoryStatus category = do
case category^.status of
CategoryFinished -> return ()
CategoryWIP -> catBanner $ do
"This category is a work in progress"
CategoryStub -> catBanner $ do
"This category is a stub, contributions are welcome!"
where
catBanner :: MonadIO m => HtmlT m () -> HtmlT m ()
catBanner divContent = do
div_ [class_ "category-status-banner"] $
h3_ divContent
renderCategoryInfo :: MonadIO m => Category -> HtmlT m ()
renderCategoryInfo category = cached (CacheCategoryInfo (category^.uid)) $ do
let thisId = "category-info-" <> uidToText (category^.uid)
@ -831,6 +846,7 @@ renderCategory :: MonadIO m => Category -> HtmlT m ()
renderCategory category = cached (CacheCategory (category^.uid)) $ do
div_ [class_ "category", id_ (categoryNodeId category)] $ do
renderCategoryInfo category
renderCategoryStatus category
renderCategoryNotes category
itemsNode <- div_ [class_ "items"] $ do
mapM_ (renderItem category) (category^.items)

View File

@ -40,3 +40,9 @@ a:link {color: #008ACE; text-decoration: none;}
a:visited {color: #B40EB4; text-decoration: none;}
a:hover {text-decoration: underline;}
a:active {text-decoration: underline;}
.category-status-banner {
background-color: #FFE97A;
text-align: center;
border: 2px solid #202020;
}