From ceb0d951c1893ca75f45482939e2c4aaebb819cf Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Tue, 27 Sep 2022 08:04:55 +0000 Subject: [PATCH] UI: Personal overview: List your repos, decks, looms --- src/Vervis/Handler/Client.hs | 37 +++++++++++++++++++++++++---- templates/personal-overview.hamlet | 30 +++++++++++++++++++++++ templates/widget/breadcrumbs.hamlet | 4 ++-- 3 files changed, 65 insertions(+), 6 deletions(-) diff --git a/src/Vervis/Handler/Client.hs b/src/Vervis/Handler/Client.hs index 5b6e4a0..a375083 100644 --- a/src/Vervis/Handler/Client.hs +++ b/src/Vervis/Handler/Client.hs @@ -146,10 +146,39 @@ getHomeR = do Nothing -> redirect BrowseR where personalOverview :: Entity Person -> Handler Html - personalOverview (Entity _pid _person) = - defaultLayout $ do - setTitle "Vervis > Overview" - $(widgetFile "personal-overview") + personalOverview (Entity pid _person) = do + (repos, decks, looms) <- runDB $ (,,) + <$> (E.select $ E.from $ \ (recip `E.InnerJoin` collab `E.InnerJoin` enable `E.InnerJoin` repo `E.InnerJoin` actor) -> do + E.on $ repo E.^. RepoActor E.==. actor E.^. ActorId + E.on $ collab E.^. CollabTopicRepoRepo E.==. repo E.^. RepoId + E.on $ collab E.^. CollabTopicRepoCollab E.==. enable E.^. CollabEnableCollab + E.on $ recip E.^. CollabRecipLocalCollab E.==. collab E.^. CollabTopicRepoCollab + E.where_ $ recip E.^. CollabRecipLocalPerson E.==. E.val pid + E.orderBy [E.asc $ repo E.^. RepoId] + return (repo, actor) + ) + <*> (E.select $ E.from $ \ (recip `E.InnerJoin` collab `E.InnerJoin` enable `E.InnerJoin` deck `E.InnerJoin` actor) -> do + E.on $ deck E.^. DeckActor E.==. actor E.^. ActorId + E.on $ collab E.^. CollabTopicDeckDeck E.==. deck E.^. DeckId + E.on $ collab E.^. CollabTopicDeckCollab E.==. enable E.^. CollabEnableCollab + E.on $ recip E.^. CollabRecipLocalCollab E.==. collab E.^. CollabTopicDeckCollab + E.where_ $ recip E.^. CollabRecipLocalPerson E.==. E.val pid + E.orderBy [E.asc $ deck E.^. DeckId] + return (deck, actor) + ) + <*> (E.select $ E.from $ \ (recip `E.InnerJoin` collab `E.InnerJoin` enable `E.InnerJoin` loom `E.InnerJoin` actor) -> do + E.on $ loom E.^. LoomActor E.==. actor E.^. ActorId + E.on $ collab E.^. CollabTopicLoomLoom E.==. loom E.^. LoomId + E.on $ collab E.^. CollabTopicLoomCollab E.==. enable E.^. CollabEnableCollab + E.on $ recip E.^. CollabRecipLocalCollab E.==. collab E.^. CollabTopicLoomCollab + E.where_ $ recip E.^. CollabRecipLocalPerson E.==. E.val pid + E.orderBy [E.asc $ loom E.^. LoomId] + return (loom, actor) + ) + hashRepo <- getEncodeKeyHashid + hashDeck <- getEncodeKeyHashid + hashLoom <- getEncodeKeyHashid + defaultLayout $(widgetFile "personal-overview") getBrowseR :: Handler Html getBrowseR = do diff --git a/templates/personal-overview.hamlet b/templates/personal-overview.hamlet index 152948e..7010b39 100644 --- a/templates/personal-overview.hamlet +++ b/templates/personal-overview.hamlet @@ -17,6 +17,8 @@ $# . personal overview here. Your projects, repos, news, notifications, settings and so on. +

Actions +