add some UI-improvements and functionality
This commit is contained in:
@ -74,7 +74,8 @@ public class Gruppen2Controller {
|
|||||||
@PostMapping("/createGroup")
|
@PostMapping("/createGroup")
|
||||||
public String pCreateGroup(KeycloakAuthenticationToken token,
|
public String pCreateGroup(KeycloakAuthenticationToken token,
|
||||||
@RequestParam(value = "title") String title,
|
@RequestParam(value = "title") String title,
|
||||||
@RequestParam(value = "beschreibung") String beschreibung) {
|
@RequestParam(value = "beschreibung") String beschreibung,
|
||||||
|
@RequestParam(value = "visibility", required = false) Boolean visibility) {
|
||||||
|
|
||||||
Account account = keyCloakService.createAccountFromPrincipal(token);
|
Account account = keyCloakService.createAccountFromPrincipal(token);
|
||||||
controllerService.createGroup(account, title, beschreibung);
|
controllerService.createGroup(account, title, beschreibung);
|
||||||
@ -89,10 +90,9 @@ public class Gruppen2Controller {
|
|||||||
Group group = userService.getGroupById(id);
|
Group group = userService.getGroupById(id);
|
||||||
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());
|
||||||
Role role = group.getRoles().get(user);
|
|
||||||
if(group!= null) {
|
if(group!= null) {
|
||||||
model.addAttribute("group", group);
|
model.addAttribute("group", group);
|
||||||
model.addAttribute("role",role);
|
model.addAttribute("role", group.getRoles().get(user.getUser_id()));
|
||||||
return "detailsMember";
|
return "detailsMember";
|
||||||
}
|
}
|
||||||
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Group not found");
|
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Group not found");
|
||||||
|
|||||||
@ -38,11 +38,9 @@
|
|||||||
<label for="beschreibung">Beschreibung</label>
|
<label for="beschreibung">Beschreibung</label>
|
||||||
<textarea th:name="beschreibung" class="form-control" id="beschreibung" rows="3" required></textarea>
|
<textarea th:name="beschreibung" class="form-control" id="beschreibung" rows="3" required></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox p-2">
|
<div class="custom-control custom-checkbox">
|
||||||
<label for="visibility"></label>
|
<input type="checkbox" id="visibility" class="custom-control-input" th:name="visibility">
|
||||||
<input type="checkbox" id="visibility" > Privat
|
<label class="custom-control-label" for="visibility">Private Gruppe</label>
|
||||||
<label for="groupType" class="pr-5"></label>
|
|
||||||
<input type="checkbox" id="groupType"> Veranstaltung
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="sel1"></label>
|
<label for="sel1"></label>
|
||||||
|
|||||||
@ -26,8 +26,9 @@
|
|||||||
</header>
|
</header>
|
||||||
<main th:fragment="bodycontent">
|
<main th:fragment="bodycontent">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-9" style="border: 10px solid aliceblue; background: aliceblue">
|
||||||
<form action="/" method="get">
|
<form action="/" method="get">
|
||||||
<div style="border: 10px solid aliceblue; background: aliceblue">
|
|
||||||
<h1 style="color: dodgerblue; font-weight: bold" th:text="${group.getTitle()}"></h1>
|
<h1 style="color: dodgerblue; font-weight: bold" th:text="${group.getTitle()}"></h1>
|
||||||
<p style="font-weight: bold">
|
<p style="font-weight: bold">
|
||||||
<a th:if="${group.getVisibility() == group.getVisibility().PUBLIC }">Private Gruppe</a>
|
<a th:if="${group.getVisibility() == group.getVisibility().PUBLIC }">Private Gruppe</a>
|
||||||
@ -35,19 +36,26 @@
|
|||||||
</p>
|
</p>
|
||||||
<p th:text="${group.getDescription()}"></p>
|
<p th:text="${group.getDescription()}"></p>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div >
|
<div class="text-right">
|
||||||
<div th:if="${role == role.ADMIN}">
|
<button class="btn btn-danger" type="danger" style="border-style: none;">Gruppe verlassen</button>
|
||||||
<button class="btn btn-primary" type="warning">Gruppenmitglieder bearbeiten</button>
|
|
||||||
<button class="btn btn-primary" type="danger" style="background: #52a1eb; border-style: none">Gruppe verlassen</button>
|
|
||||||
</div>
|
|
||||||
<div th:if="${role == role.MEMBER}">
|
|
||||||
<button class="btn btn-primary" type="danger" style="background: #52a1eb; border-style: none">Gruppe verlassen</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
<ul th:each="member : ${group.getMembers()}" class="list-group-flush" style="background: slategrey">
|
||||||
|
<li class="list-group-item" style="background: aliceblue">
|
||||||
|
<span th:text="${member.getUser_id()}"></span>
|
||||||
|
<span th:if="${role == role.ADMIN}" class="badge badge-success">admin</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="text-right" th:if="${role == role.ADMIN}">
|
||||||
|
<button class="btn btn-secondary" type="warning" style="background: slategrey" >Gruppenmitglieder bearbeiten</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user