add login/out
This commit is contained in:
parent
7ff7513fa5
commit
f63b296e11
@ -39,6 +39,8 @@ instance HasHttpManager App where
|
|||||||
-- type Widget = WidgetT App IO ()
|
-- type Widget = WidgetT App IO ()
|
||||||
mkYesodData "App" $(parseRoutesFile "config/routes")
|
mkYesodData "App" $(parseRoutesFile "config/routes")
|
||||||
|
|
||||||
|
mkMessage "App" "messages" "en"
|
||||||
|
|
||||||
-- | A convenient synonym for creating forms.
|
-- | A convenient synonym for creating forms.
|
||||||
type Form x = Html -> MForm (HandlerT App IO) (FormResult x, Widget)
|
type Form x = Html -> MForm (HandlerT App IO) (FormResult x, Widget)
|
||||||
|
|
||||||
@ -86,6 +88,8 @@ instance Yesod App where
|
|||||||
-- value passed to hamletToRepHtml cannot be a widget, this allows
|
-- value passed to hamletToRepHtml cannot be a widget, this allows
|
||||||
-- you to use normal widget features in default-layout.
|
-- you to use normal widget features in default-layout.
|
||||||
|
|
||||||
|
maybeUser <- maybeAuth
|
||||||
|
|
||||||
pc <- widgetToPageContent $ do
|
pc <- widgetToPageContent $ do
|
||||||
addStylesheet $ StaticR css_bootstrap_css
|
addStylesheet $ StaticR css_bootstrap_css
|
||||||
$(widgetFile "default-layout")
|
$(widgetFile "default-layout")
|
||||||
|
3
messages/en.msg
Normal file
3
messages/en.msg
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
LogIn: log in
|
||||||
|
LogOut: log out
|
||||||
|
LoggedAs: logged as
|
@ -1,3 +1,9 @@
|
|||||||
|
<div id="heading">
|
||||||
|
$maybe user <- maybeUser
|
||||||
|
_{MsgLoggedAs} #{userIdent $ entityVal user}
|
||||||
|
\ | <a href="@{AuthR LogoutR}">_{MsgLogOut}</a>
|
||||||
|
$nothing
|
||||||
|
<a href="@{AuthR LoginR}">_{MsgLogIn}</a>
|
||||||
$maybe msg <- mmsg
|
$maybe msg <- mmsg
|
||||||
<div #message>#{msg}
|
<div #message>#{msg}
|
||||||
^{widget}
|
^{widget}
|
||||||
|
Loading…
Reference in New Issue
Block a user