getPersonListR :: Handler Html getPersonListR = do urlRender <- getUrlRender personEnts <- runDB $ selectList [] [Asc PersonId] let jData = map (\(Entity personId person) -> JPerson { jPersonPerson = person , jPersonEditFormUrl = urlRender $ PersonEditFormR personId } ) personEnts jsonData <- returnJson jData >>= return . toJsonText defaultLayout $ do toWidgetBody [julius|var data = #{rawJS jsonData}|] $(widgetFile "person_list") data JPerson = JPerson { jPersonPerson :: Person , jPersonEditFormUrl :: Text }
No comments:
Post a Comment