Created
December 2, 2015 15:40
-
-
Save ptkato/3c397cbf5c285fd1c421 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
formAv :: Form Avaliacao | |
formAv = renderDivs $ Avaliacao <$> | |
areq intField "Nota" Nothing <*> | |
pure kludge <*> | |
areq (selectField lv) "Livro:" Nothing <*> | |
areq textField "Avaliação: " Nothing | |
kludge = case us of | |
Just (Entity pid user) -> pid | |
Nothing -> redirect LoginR | |
us = do | |
xy <- lookupSession "_ID" | |
case xy of | |
Just x -> runDB $ selectFirst [UsuarioNome ==. x] [] | |
Nothing -> redirect LoginR | |
lv = do | |
entidades <- runDB $ selectList [] [Asc LivroNm_Livro] | |
optionsPairs $ fmap(\ent -> (livroNm_Livro $ entityVal ent, entityKey ent)) entidades |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment