Skip to content

Commit

Permalink
Show more user info in various admin contexts, such as group lists
Browse files Browse the repository at this point in the history
Also make user emails available to admin users
  • Loading branch information
mikesname committed Nov 19, 2021
1 parent 42c875d commit 0558940
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 4 deletions.
2 changes: 1 addition & 1 deletion modules/admin/app/controllers/groups/Groups.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ case class Groups @Inject()(

def get(id: String, paging: PageParams): Action[AnyContent] = ItemMetaAction(id).async { implicit request =>
for {
page <- userDataApi.children[Group,Accessor](id, paging)
page <- userDataApi.children[Group, Accessor](id, paging)
accs <- accounts.findAllById(ids = page.items.collect { case up: UserProfile => up.id })
} yield {
val pageWithAccounts = page.copy(items = page.items.map {
Expand Down
40 changes: 37 additions & 3 deletions modules/admin/app/views/admin/group/show.scala.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,35 @@
@(item: Group, page: utils.Page[Accessor], params: utils.PageParams, annotations: Seq[Annotation])(implicit userOpt: Option[UserProfile], req: RequestHeader, conf: AppConfig, messages: Messages, md: MarkdownRenderer, prefs: SessionPrefs, flash: Flash)
@(item: Group, page: _root_.utils.Page[Accessor], params: utils.PageParams, annotations: Seq[Annotation])(implicit userOpt: Option[UserProfile], req: RequestHeader, conf: AppConfig, messages: Messages, md: MarkdownRenderer, prefs: SessionPrefs, flash: Flash)

@name(acc: Accessor) = {
@acc match {
case user: UserProfile if !user.data.active => {
@user.toStringLang (@Messages("userProfile.active.false"))
}
case _ => {
@acc.toStringLang
}
}
}

@cls(acc: Accessor) = {
@acc match {
case user: UserProfile if !user.data.active => {
text-muted
}
case _ => {
}
}
}

@badges(acc: Accessor) = {
@acc match {
case user: UserProfile => {
@views.html.admin.userProfile.statusBadges(user)
}
case _ => {
}
}
}

@removeLink(acc: Accessor) = {
@if(acc.isA == EntityType.Group) {
Expand Down Expand Up @@ -29,8 +60,11 @@
@views.html.admin.common.filterableList("group.membersPageHeader", page, params) {
<ul>
@page.items.map { member =>
<h4><a href="@views.admin.Helpers.linkTo(member)">@member.toStringLang</a></h4>
@removeLink(member)
<h4>
<a class="@cls(member)" href="@views.admin.Helpers.linkTo(member)">@name(member)</a>
@badges(member)
</h4>
@removeLink(member)
<hr />
}
</ul>
Expand Down
6 changes: 6 additions & 0 deletions modules/admin/app/views/admin/userProfile/show.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
@views.html.admin.userProfile.itemPage(item) {

<dl class="description">
@if(userOpt.exists(_.isAdmin)) {
@item.account.map { account =>
<dt>@Messages("userProfile.email")</dt>
<dd>@account.email</dd>
}
}
@item.data.location.map { loc =>
<dt>@Messages("userProfile.location")</dt>
<dd>@loc</dd>
Expand Down

0 comments on commit 0558940

Please sign in to comment.