diff --git a/Foundation.hs b/Foundation.hs index 23efceb..d436751 100644 --- a/Foundation.hs +++ b/Foundation.hs @@ -39,6 +39,8 @@ instance HasHttpManager App where -- type Widget = WidgetT App IO () mkYesodData "App" $(parseRoutesFile "config/routes") +mkMessage "App" "messages" "en" + -- | A convenient synonym for creating forms. 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 -- you to use normal widget features in default-layout. + maybeUser <- maybeAuth + pc <- widgetToPageContent $ do addStylesheet $ StaticR css_bootstrap_css $(widgetFile "default-layout") diff --git a/messages/en.msg b/messages/en.msg new file mode 100644 index 0000000..434f70f --- /dev/null +++ b/messages/en.msg @@ -0,0 +1,3 @@ +LogIn: log in +LogOut: log out +LoggedAs: logged as diff --git a/templates/default-layout.hamlet b/templates/default-layout.hamlet index 3701e3c..36cc204 100644 --- a/templates/default-layout.hamlet +++ b/templates/default-layout.hamlet @@ -1,3 +1,9 @@ +
+ $maybe user <- maybeUser + _{MsgLoggedAs} #{userIdent $ entityVal user} + \ | _{MsgLogOut} + $nothing + _{MsgLogIn} $maybe msg <- mmsg -
#{msg} +
#{msg} ^{widget}