1

add some UI-improvements and functionality

This commit is contained in:
killerber4t
2020-03-14 01:11:56 +01:00
parent c4f90e0baf
commit 3849b61614
3 changed files with 31 additions and 25 deletions

View File

@ -74,7 +74,8 @@ public class Gruppen2Controller {
@PostMapping("/createGroup")
public String pCreateGroup(KeycloakAuthenticationToken token,
@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);
controllerService.createGroup(account, title, beschreibung);
@ -89,10 +90,9 @@ public class Gruppen2Controller {
Group group = userService.getGroupById(id);
Account account = keyCloakService.createAccountFromPrincipal (token);
User user = new User(account.getName(), account.getGivenname(), account.getFamilyname(), account.getEmail());
Role role = group.getRoles().get(user);
if(group!= null) {
model.addAttribute("group", group);
model.addAttribute("role",role);
model.addAttribute("role", group.getRoles().get(user.getUser_id()));
return "detailsMember";
}
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Group not found");

View File

@ -38,11 +38,9 @@
<label for="beschreibung">Beschreibung</label>
<textarea th:name="beschreibung" class="form-control" id="beschreibung" rows="3" required></textarea>
</div>
<div class="checkbox p-2">
<label for="visibility"></label>
<input type="checkbox" id="visibility" > Privat
<label for="groupType" class="pr-5"></label>
<input type="checkbox" id="groupType"> Veranstaltung
<div class="custom-control custom-checkbox">
<input type="checkbox" id="visibility" class="custom-control-input" th:name="visibility">
<label class="custom-control-label" for="visibility">Private Gruppe</label>
</div>
<div class="form-group">
<label for="sel1"></label>

View File

@ -26,28 +26,36 @@
</header>
<main th:fragment="bodycontent">
<div class="container-fluid">
<form action="/" method="get">
<div style="border: 10px solid aliceblue; background: aliceblue">
<h1 style="color: dodgerblue; font-weight: bold" th:text="${group.getTitle()}"></h1>
<p style="font-weight: bold">
<a th:if="${group.getVisibility() == group.getVisibility().PUBLIC }">Private Gruppe</a>
<a th:if="${group.getVisibility() == group.getVisibility().PRIVATE}">Öffentliche Gruppe</a>
</p>
<p th:text="${group.getDescription()}"></p>
<div class="form-group">
<div >
<div th:if="${role == role.ADMIN}">
<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 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">
<a th:if="${group.getVisibility() == group.getVisibility().PUBLIC }">Private Gruppe</a>
<a th:if="${group.getVisibility() == group.getVisibility().PRIVATE}">Öffentliche Gruppe</a>
</p>
<p th:text="${group.getDescription()}"></p>
<div class="form-group">
<div class="text-right">
<button class="btn btn-danger" type="danger" style="border-style: none;">Gruppe verlassen</button>
</div>
</div>
</form>
</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>
</form>
</div>
</main>
</body>
</html>