Adjust home layout: push my h-card over to the side and display recent entries in the main content area
This commit is contained in:
parent
3ff560e07e
commit
36dea2b5ad
4 changed files with 16 additions and 7 deletions
|
@ -7,19 +7,20 @@ module Handler.Home where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
import Widget.Card ( hCard )
|
import Widget.Card ( hCard )
|
||||||
|
import Widget.Feed ( hFeed )
|
||||||
|
|
||||||
getHomeR :: Handler Html
|
getHomeR :: Handler Html
|
||||||
getHomeR = do
|
getHomeR = do
|
||||||
user <- runDB . getBy404 $ UniqueUser "dani"
|
userE@(Entity userId user) <- runDB . getBy404 $ UniqueUser "dani"
|
||||||
let name = userFullName . entityVal $ user
|
|
||||||
maybeTitle <- asks $ appTitle . appSettings
|
maybeTitle <- asks $ appTitle . appSettings
|
||||||
|
entries <- runDB $ selectList [EntryAuthorId ==. userId] [Desc EntryPublished]
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
case maybeTitle of
|
case maybeTitle of
|
||||||
Just title -> setTitle $ toHtml title
|
Just title -> setTitle $ toHtml title
|
||||||
Nothing -> return ()
|
Nothing -> return ()
|
||||||
toWidgetHead
|
toWidgetHead
|
||||||
[hamlet|
|
[hamlet|
|
||||||
<meta name="author" content=#{name}>
|
<meta name="author" content=#{userFullName user}>
|
||||||
<link rel="author" href=@{HomeR}>
|
<link rel="author" href=@{HomeR}>
|
||||||
|]
|
|]
|
||||||
$(widgetFile "home")
|
$(widgetFile "home")
|
||||||
|
|
8
templates/home.cassius
Normal file
8
templates/home.cassius
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
body > main
|
||||||
|
display: flex
|
||||||
|
flex-direction: row-reverse
|
||||||
|
margin: 2em
|
||||||
|
> .entries
|
||||||
|
flex: 1
|
||||||
|
> .author
|
||||||
|
max-width: 30%
|
|
@ -1 +1,4 @@
|
||||||
^{hCard user}
|
<div .author>
|
||||||
|
^{hCard userE}
|
||||||
|
<div .entries>
|
||||||
|
^{hFeed entries}
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
.card.h-card
|
.card.h-card
|
||||||
margin: 2em auto
|
|
||||||
width: 22rem
|
|
||||||
|
|
||||||
ul.profiles
|
ul.profiles
|
||||||
list-style: none
|
list-style: none
|
||||||
padding-left: 0
|
padding-left: 0
|
||||||
|
|
Loading…
Reference in a new issue