order my groups by type
This commit is contained in:
@ -17,6 +17,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@ -67,6 +68,24 @@ public class GroupCache {
|
|||||||
return Collections.unmodifiableList(users.get(userid));
|
return Collections.unmodifiableList(users.get(userid));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Group> userLectures(String userid) {
|
||||||
|
return userGroups(userid).stream()
|
||||||
|
.filter(Group::isLecture)
|
||||||
|
.collect(Collectors.toUnmodifiableList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Group> userPublics(String userid) {
|
||||||
|
return userGroups(userid).stream()
|
||||||
|
.filter(Group::isPublic)
|
||||||
|
.collect(Collectors.toUnmodifiableList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Group> userPrivates(String userid) {
|
||||||
|
return userGroups(userid).stream()
|
||||||
|
.filter(Group::isPrivate)
|
||||||
|
.collect(Collectors.toUnmodifiableList());
|
||||||
|
}
|
||||||
|
|
||||||
public List<Group> publics() {
|
public List<Group> publics() {
|
||||||
if (!types.containsKey(Type.PUBLIC)) {
|
if (!types.containsKey(Type.PUBLIC)) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
@ -33,7 +33,10 @@ public class GruppenfindungController {
|
|||||||
@GetMapping("/gruppen2")
|
@GetMapping("/gruppen2")
|
||||||
public String getIndexPage(KeycloakAuthenticationToken token,
|
public String getIndexPage(KeycloakAuthenticationToken token,
|
||||||
Model model) {
|
Model model) {
|
||||||
model.addAttribute("groups", groupCache.userGroups(token.getName()));
|
|
||||||
|
model.addAttribute("lectures", groupCache.userLectures(token.getName()));
|
||||||
|
model.addAttribute("publics", groupCache.userPublics(token.getName()));
|
||||||
|
model.addAttribute("privates", groupCache.userPrivates(token.getName()));
|
||||||
|
|
||||||
return "index";
|
return "index";
|
||||||
}
|
}
|
||||||
|
@ -13,19 +13,52 @@
|
|||||||
|
|
||||||
<h1 class="def-cursor">Meine Gruppen</h1>
|
<h1 class="def-cursor">Meine Gruppen</h1>
|
||||||
|
|
||||||
|
<!--TODO: Fragment-->
|
||||||
<!--Gruppenliste belegte Gruppen-->
|
<!--Gruppenliste belegte Gruppen-->
|
||||||
<div class="content" th:each="group: ${groups}">
|
<div th:unless="${lectures.isEmpty()}">
|
||||||
<div class="content-heading row">
|
<h3 class="def-cursor">Veranstaltungen</h3>
|
||||||
<a class="link col" th:href="@{/gruppen2/details/{id}(id=${group.getId()})}"
|
<div class="content" th:each="group: ${lectures}">
|
||||||
th:text="${group.getTitle()}"></a>
|
<div class="content-heading row">
|
||||||
|
<a class="link col" th:href="@{/gruppen2/details/{id}(id=${group.getId()})}"
|
||||||
|
th:text="${group.getTitle()}"></a>
|
||||||
|
|
||||||
<span th:replace="~{fragments/groups :: badges}"></span>
|
<span th:replace="~{fragments/groups :: badges}"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="content-text-in">
|
<div class="content-text-in">
|
||||||
<span th:text="${group.getDescription()}"></span>
|
<span th:text="${group.getDescription()}"></span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div th:unless="${publics.isEmpty()}">
|
||||||
|
<h3 class="def-cursor">Öffentliche Gruppen</h3>
|
||||||
|
<div class="content" th:each="group: ${publics}">
|
||||||
|
<div class="content-heading row">
|
||||||
|
<a class="link col" th:href="@{/gruppen2/details/{id}(id=${group.getId()})}"
|
||||||
|
th:text="${group.getTitle()}"></a>
|
||||||
|
|
||||||
|
<span th:replace="~{fragments/groups :: badges}"></span>
|
||||||
|
</div>
|
||||||
|
<div class="content-text-in">
|
||||||
|
<span th:text="${group.getDescription()}"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div th:unless="${privates.isEmpty()}">
|
||||||
|
<h3 class="def-cursor">Private Gruppen</h3>
|
||||||
|
<div class="content" th:each="group: ${privates}">
|
||||||
|
<div class="content-heading row">
|
||||||
|
<a class="link col" th:href="@{/gruppen2/details/{id}(id=${group.getId()})}"
|
||||||
|
th:text="${group.getTitle()}"></a>
|
||||||
|
|
||||||
|
<span th:replace="~{fragments/groups :: badges}"></span>
|
||||||
|
</div>
|
||||||
|
<div class="content-text-in">
|
||||||
|
<span th:text="${group.getDescription()}"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user