shit doesn't work

This commit is contained in:
nek0 2014-08-15 13:24:14 +02:00
parent 87611667a7
commit a992307327
4 changed files with 21 additions and 2 deletions

View file

@ -21,6 +21,7 @@ import Yesod.Core.Types (Logger)
-- costom imports
import Data.Maybe
import Data.Text
import Helper
-- | The site argument for your application. This can be a good place to
-- keep settings and values requiring initialization before your application

View file

@ -37,3 +37,4 @@ albumForm userId = renderDivs $ Album
<$> areq textField "Title" Nothing
<*> pure userId
<*> pure []
<*> pure Nothing

View file

@ -1,14 +1,23 @@
module Helper
( getUserIdFromText
, extractKey
-- , getUserName
)
where
import Prelude
import Model
import Control.Applicative
import Control.Monad.Trans.Class
import Data.Text
import Data.Maybe
import Database.Persist
import Database.Persist.Types
import System.FilePath
import Yesod.Persist.Core
import Yesod.Core.Types
getUserIdFromText :: Text -> PersistValue
getUserIdFromText :: Text -> UserId
getUserIdFromText tempUserId =
PersistInt64 $ fromIntegral $ read $ unpack tempUserId
@ -17,3 +26,11 @@ extractKey = extractKey' . unKey
where
extractKey' (PersistInt64 k) = pack $ show k
extractKey' _ = ""
--getUserName :: Text -> User
--getUserName textId =
-- let
-- userId = getUserIdFromText textId
-- user = get $ userId
-- in
-- show user

View file

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