Add template for detailsNoMember.html, that displays the details when you search a page.
Add connection to the controller
This commit is contained in:
@ -112,4 +112,16 @@ public class Gruppen2Controller {
|
||||
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Group not found");
|
||||
}
|
||||
|
||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin", "ROLE_actuator)"})
|
||||
@GetMapping("/detailsSearch")
|
||||
public String showGroupDetailsNoMember (KeycloakAuthenticationToken token, Model model, @RequestParam (value="id") Long id) throws EventException {
|
||||
model.addAttribute("account", keyCloakService.createAccountFromPrincipal(token));
|
||||
Group group = userService.getGroupById(id);
|
||||
if (group!=null) {
|
||||
model.addAttribute("group", group);
|
||||
return "detailsNoMember";
|
||||
}
|
||||
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Group not found");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -25,7 +25,26 @@
|
||||
</nav>
|
||||
</header>
|
||||
<main th:fragment="bodycontent">
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-9" style="border: 10px solid aliceblue; background: aliceblue">
|
||||
<form action="/" method="get">
|
||||
<h1 style="color: dodgerblue; font-weight: bold" th:text="${group.getTitle()}"></h1>
|
||||
<p style="font-weight: bold">
|
||||
<span class="badge badge-pill badge-dark" style="background: darkslategray" th:if="${group.getVisibility() == group.getVisibility().PRIVATE }">Private Gruppe</span>
|
||||
<span class="badge badge-pill badge-primary" th:if="${group.getVisibility() == group.getVisibility().PUBLIC}">Öffentliche Gruppe</span>
|
||||
<span class="badge badge-pill badge-success" style="background: lightseagreen" th:if="${group.getType() == group.getType().LECTURE}"> Veranstaltung</span>
|
||||
</p>
|
||||
<p th:text="${group.getDescription()}"></p>
|
||||
<div class="form-group">
|
||||
<div class="text-right">
|
||||
<button class="btn btn-primary" style="border-style: none;">Gruppe beitreten</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
@ -42,20 +42,22 @@
|
||||
<table class="table">
|
||||
<!-- Erscheint dann, wenn man "Suchen" Button klickt und Ergebnisse angezeigt werden, aber so solls aussehen -->
|
||||
<thead th:if="${!gruppen.isEmpty()}">
|
||||
<tr>
|
||||
<th scope="col">Gruppenname</th>
|
||||
<th scope="col">Beschreibung</th>
|
||||
<th scope="col">Öffentlich/Privat</th>
|
||||
<th scope="col">Mitgliederanzahl</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="col">Gruppenname</th>
|
||||
<th scope="col">Beschreibung</th>
|
||||
<th scope="col">Öffentlich/Privat</th>
|
||||
<th scope="col">Mitgliederanzahl</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody th:each="gruppe : ${gruppen}">
|
||||
<tr>
|
||||
<th scope="row" th:text="${gruppe.title}">Gruppenname</th>
|
||||
<td th:text="${gruppe.getDescription()}">Beschreibung</td>
|
||||
<td th:text="${gruppe.getVisibility()}">Öffentlich</td>
|
||||
<td th:text="${gruppe.getMembers().size()}">Mitgliederanzahl</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<a th:href="@{/gruppen2/detailsSearch(id=${gruppe.getId()})}" th:text="${gruppe.title}">Gruppenname</a>
|
||||
</th>
|
||||
<td th:text="${gruppe.getDescription()}">Beschreibung</td>
|
||||
<td th:text="${gruppe.getVisibility()}">Öffentlich</td>
|
||||
<td th:text="${gruppe.getMembers().size()}">Mitgliederanzahl</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user