Display group members in group page
This commit is contained in:
parent
75f8fd7b7b
commit
b50f892d32
2 changed files with 23 additions and 7 deletions
|
@ -24,6 +24,7 @@ where
|
||||||
import Prelude
|
import Prelude
|
||||||
|
|
||||||
import Control.Monad.IO.Class (liftIO)
|
import Control.Monad.IO.Class (liftIO)
|
||||||
|
import Data.Maybe (fromMaybe)
|
||||||
import Data.Time.Clock (getCurrentTime)
|
import Data.Time.Clock (getCurrentTime)
|
||||||
import Database.Esqueleto
|
import Database.Esqueleto
|
||||||
import Text.Blaze.Html (Html)
|
import Text.Blaze.Html (Html)
|
||||||
|
@ -36,9 +37,9 @@ import Yesod.Persist.Core (runDB, getBy404)
|
||||||
import Vervis.Form.Group
|
import Vervis.Form.Group
|
||||||
import Vervis.Foundation
|
import Vervis.Foundation
|
||||||
import Vervis.Model
|
import Vervis.Model
|
||||||
import Vervis.Model.Ident (ShrIdent)
|
import Vervis.Model.Ident (ShrIdent, shr2text)
|
||||||
import Vervis.Settings (widgetFile)
|
import Vervis.Settings (widgetFile)
|
||||||
import Vervis.Widget.Sharer (groupLinkW)
|
import Vervis.Widget.Sharer (groupLinkW, personLinkW)
|
||||||
|
|
||||||
getGroupsR :: Handler Html
|
getGroupsR :: Handler Html
|
||||||
getGroupsR = do
|
getGroupsR = do
|
||||||
|
@ -80,8 +81,15 @@ getGroupNewR = do
|
||||||
|
|
||||||
getGroupR :: ShrIdent -> Handler Html
|
getGroupR :: ShrIdent -> Handler Html
|
||||||
getGroupR shar = do
|
getGroupR shar = do
|
||||||
group <- runDB $ do
|
(group, members) <- runDB $ do
|
||||||
Entity sid _s <- getBy404 $ UniqueSharer shar
|
Entity sid s <- getBy404 $ UniqueSharer shar
|
||||||
Entity _gid g <- getBy404 $ UniqueGroup sid
|
Entity gid _g <- getBy404 $ UniqueGroup sid
|
||||||
return g
|
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")
|
defaultLayout $(widgetFile "group/one")
|
||||||
|
|
|
@ -12,5 +12,13 @@ $# You should have received a copy of the CC0 Public Domain Dedication along
|
||||||
$# with this software. If not, see
|
$# with this software. If not, see
|
||||||
$# <http://creativecommons.org/publicdomain/zero/1.0/>.
|
$# <http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||||
|
|
||||||
|
<h2>
|
||||||
|
#{fromMaybe (shr2text $ sharerIdent group) $ sharerName group}
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
TODO list the group's members here, and later also roles etc.
|
Members:
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
$forall Entity _sid s <- members
|
||||||
|
<li>
|
||||||
|
^{personLinkW s}
|
||||||
|
|
Loading…
Reference in a new issue