Create an h-card widget and display my h-card on the homepage - needs more info but it's a good start

This commit is contained in:
Danielle McLean 2017-10-03 00:52:14 +11:00
parent 5eccafa9c2
commit 006264e77f
Signed by: 00dani
GPG key ID: 3844A6973C6058F1
6 changed files with 27 additions and 2 deletions

View file

@ -217,7 +217,9 @@ instance YesodAuth App where
case x of
Just (Entity uid _) -> return $ Authenticated uid
Nothing -> Authenticated <$> insert User
{ userIdent = credsIdent creds
{ userAvatar = Nothing
, userIdent = credsIdent creds
, userFullName = ""
, userPassword = Nothing
}

View file

@ -6,6 +6,9 @@
module Handler.Home where
import Import
import Widget.Hcard (hcard)
getHomeR :: Handler Html
getHomeR = defaultLayout $(widgetFile "home")
getHomeR = do
(Entity _ user) <- runDB . getBy404 $ UniqueUser "dani"
defaultLayout $(widgetFile "home")

12
src/Widget/Hcard.hs Normal file
View file

@ -0,0 +1,12 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
module Widget.Hcard (hcard) where
import Import
img :: Text -> Route App
img file = StaticR . flip StaticRoute [] $ ["img", file]
hcard :: User -> Widget
hcard user = $(widgetFile "hcard")