1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2024-12-27 16:44:52 +09:00

Display group members in group page

This commit is contained in:
fr33domlover 2016-05-25 07:24:34 +00:00
parent 75f8fd7b7b
commit b50f892d32
2 changed files with 23 additions and 7 deletions

View file

@ -24,6 +24,7 @@ where
import Prelude
import Control.Monad.IO.Class (liftIO)
import Data.Maybe (fromMaybe)
import Data.Time.Clock (getCurrentTime)
import Database.Esqueleto
import Text.Blaze.Html (Html)
@ -36,9 +37,9 @@ import Yesod.Persist.Core (runDB, getBy404)
import Vervis.Form.Group
import Vervis.Foundation
import Vervis.Model
import Vervis.Model.Ident (ShrIdent)
import Vervis.Model.Ident (ShrIdent, shr2text)
import Vervis.Settings (widgetFile)
import Vervis.Widget.Sharer (groupLinkW)
import Vervis.Widget.Sharer (groupLinkW, personLinkW)
getGroupsR :: Handler Html
getGroupsR = do
@ -80,8 +81,15 @@ getGroupNewR = do
getGroupR :: ShrIdent -> Handler Html
getGroupR shar = do
group <- runDB $ do
Entity sid _s <- getBy404 $ UniqueSharer shar
Entity _gid g <- getBy404 $ UniqueGroup sid
return g
(group, members) <- runDB $ do
Entity sid s <- getBy404 $ UniqueSharer shar
Entity gid _g <- getBy404 $ UniqueGroup sid
ms <- select $ from $ \ (member, person, sharer) -> do
where_ $
member ^. GroupMemberGroup ==. val gid &&.
member ^. GroupMemberPerson ==. person ^. PersonId &&.
person ^. PersonIdent ==. sharer ^. SharerId
orderBy [asc $ sharer ^. SharerIdent]
return sharer
return (s, ms)
defaultLayout $(widgetFile "group/one")

View file

@ -12,5 +12,13 @@ $# You should have received a copy of the CC0 Public Domain Dedication along
$# with this software. If not, see
$# <http://creativecommons.org/publicdomain/zero/1.0/>.
<h2>
#{fromMaybe (shr2text $ sharerIdent group) $ sharerName group}
<p>
TODO list the group's members here, and later also roles etc.
Members:
<ul>
$forall Entity _sid s <- members
<li>
^{personLinkW s}