Add badge that displays parent group in detail site
This commit is contained in:
@ -172,7 +172,14 @@ public class Gruppen2Controller {
|
|||||||
Group group = userService.getGroupById(groupId);
|
Group group = userService.getGroupById(groupId);
|
||||||
Account account = keyCloakService.createAccountFromPrincipal(token);
|
Account account = keyCloakService.createAccountFromPrincipal(token);
|
||||||
User user = new User(account.getName(), account.getGivenname(), account.getFamilyname(), account.getEmail());
|
User user = new User(account.getName(), account.getGivenname(), account.getFamilyname(), account.getEmail());
|
||||||
|
Long parentId = group.getParent();
|
||||||
|
Group parent = new Group();
|
||||||
|
if (parentId != null) {
|
||||||
|
parent = userService.getGroupById(parentId);
|
||||||
|
}
|
||||||
if (group != null) {
|
if (group != null) {
|
||||||
|
model.addAttribute("parentId", parentId);
|
||||||
|
model.addAttribute("parent", parent);
|
||||||
model.addAttribute("group", group);
|
model.addAttribute("group", group);
|
||||||
model.addAttribute("roles", group.getRoles());
|
model.addAttribute("roles", group.getRoles());
|
||||||
model.addAttribute("user", user);
|
model.addAttribute("user", user);
|
||||||
@ -204,8 +211,15 @@ public class Gruppen2Controller {
|
|||||||
public String showGroupDetailsNoMember(KeycloakAuthenticationToken token, Model model, @RequestParam("id") Long groupId) throws EventException {
|
public String showGroupDetailsNoMember(KeycloakAuthenticationToken token, Model model, @RequestParam("id") Long groupId) throws EventException {
|
||||||
model.addAttribute("account", keyCloakService.createAccountFromPrincipal(token));
|
model.addAttribute("account", keyCloakService.createAccountFromPrincipal(token));
|
||||||
Group group = userService.getGroupById(groupId);
|
Group group = userService.getGroupById(groupId);
|
||||||
|
Long parentId = group.getParent();
|
||||||
|
Group parent = new Group();
|
||||||
|
if (parentId != null) {
|
||||||
|
parent = userService.getGroupById(parentId);
|
||||||
|
}
|
||||||
if (group != null && group.getUserMaximum() > group.getMembers().size()) {
|
if (group != null && group.getUserMaximum() > group.getMembers().size()) {
|
||||||
model.addAttribute("group", group);
|
model.addAttribute("group", group);
|
||||||
|
model.addAttribute("parentId", parentId);
|
||||||
|
model.addAttribute("parent", parent);
|
||||||
return "detailsNoMember";
|
return "detailsNoMember";
|
||||||
}
|
}
|
||||||
throw new GroupNotFoundException(this.getClass().toString());
|
throw new GroupNotFoundException(this.getClass().toString());
|
||||||
|
|||||||
@ -40,6 +40,8 @@
|
|||||||
th:if="${group.getVisibility() == group.getVisibility().PUBLIC}">Öffentliche Gruppe</span>
|
th:if="${group.getVisibility() == group.getVisibility().PUBLIC}">Öffentliche Gruppe</span>
|
||||||
<span class="badge badge-pill badge-success" style="background: lightseagreen"
|
<span class="badge badge-pill badge-success" style="background: lightseagreen"
|
||||||
th:if='${group.getType() == group.getType().LECTURE}'>Veranstaltung</span>
|
th:if='${group.getType() == group.getType().LECTURE}'>Veranstaltung</span>
|
||||||
|
<span class="badge badge-pill badge-info" style="background: lightseagreen"
|
||||||
|
th:text="${parent.getTitle()}">Parent</span>
|
||||||
</h3>
|
</h3>
|
||||||
<br>
|
<br>
|
||||||
<div class="shadow-sm p-4" style="background: white">
|
<div class="shadow-sm p-4" style="background: white">
|
||||||
|
|||||||
@ -41,6 +41,8 @@
|
|||||||
<span class="badge badge-pill badge-success"
|
<span class="badge badge-pill badge-success"
|
||||||
style="background: lightseagreen"
|
style="background: lightseagreen"
|
||||||
th:if='${group.getType() == group.getType().LECTURE}'> Veranstaltung</span>
|
th:if='${group.getType() == group.getType().LECTURE}'> Veranstaltung</span>
|
||||||
|
<span class="badge badge-pill badge-info" style="background: lightseagreen"
|
||||||
|
th:text="${parent.getTitle()}">Parent</span>
|
||||||
</h3>
|
</h3>
|
||||||
<div class="shadow-sm p-4" style="background: white">
|
<div class="shadow-sm p-4" style="background: white">
|
||||||
<p style="overflow-wrap: break-word"
|
<p style="overflow-wrap: break-word"
|
||||||
|
|||||||
Reference in New Issue
Block a user