1

Merge pull request #89 from hhu-propra2/Join_Group

add Join Group
This commit is contained in:
AndiBuls
2020-03-17 15:25:54 +01:00
committed by GitHub
2 changed files with 12 additions and 3 deletions

View File

@ -116,6 +116,15 @@ public class Gruppen2Controller {
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Group not found");
}
@RolesAllowed({"ROLE_orga", "ROLE_studentin", "ROLE_actuator)"})
@PostMapping("/detailsBeitreten")
public String joinGroup(KeycloakAuthenticationToken token, Model model, @RequestParam(value = "id") Long id) throws EventException {
model.addAttribute("account", keyCloakService.createAccountFromPrincipal(token));
Account account = keyCloakService.createAccountFromPrincipal (token);
controllerService.addUser(account,id);
return "redirect:/gruppen2/";
}
@RolesAllowed({"ROLE_orga", "ROLE_studentin", "ROLE_actuator)"})
@GetMapping("/detailsSearch")
public String showGroupDetailsNoMember (KeycloakAuthenticationToken token, Model model, @RequestParam (value="id") Long id) throws EventException {

View File

@ -29,7 +29,6 @@
<div class="row">
<div class="col-9">
<div class="shadow-sm p-4" 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>
@ -39,10 +38,11 @@
<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>
<form method="post" action="/gruppen2/detailsBeitreten">
<button type="submit" th:href="@{/gruppen2/detailsBeitreten(id=${group.getId()})}" th:name="id" th:value="${group.id}" class="btn btn-primary" style="border-style: none;">Gruppe beitreten</button>
</form>
</div>
</div>
</form>
</div>
</div>
</div>