added user slug (just for dodo)

This commit is contained in:
nek0 2014-08-26 04:36:21 +02:00
parent c60e8cdcd9
commit edf583dcfb
3 changed files with 10 additions and 3 deletions

View file

@ -74,6 +74,13 @@ instance Yesod App where
return $ userName user return $ userName user
Nothing -> do Nothing -> do
return ("" :: Text) return ("" :: Text)
slug <- case msu of
Just a -> do
uId <- return $ getUserIdFromText a
user <- runDB $ getJust uId
return $ userSlug user
Nothing -> do
return ("" :: Text)
-- We break up the default layout into two components: -- We break up the default layout into two components:

View file

@ -1,9 +1,9 @@
User User
name Text name Text
slug Text
email Text email Text
password Text
salt ByteString salt ByteString
salted ByteString Maybe salted ByteString
albums [AlbumId] albums [AlbumId]
deriving Typeable deriving Typeable
Activator Activator

View file

@ -2,7 +2,7 @@
<div id="top-nav"> <div id="top-nav">
<ul id="user-nav"> <ul id="user-nav">
$maybe userId <- msu $maybe userId <- msu
Logged in as <a href=@{UserR username}>#{username} Logged in as <a href=@{UserR username}>#{slug}
<li> <li>
<a href=@{LogoutR}>Logout <a href=@{LogoutR}>Logout
<li> <li>