fix problem where search was keeping same search throughout session and some UI changes
This commit is contained in:
@ -70,20 +70,16 @@ public class Gruppen2Controller {
|
||||
|
||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin", "ROLE_actuator)"})
|
||||
@GetMapping("/findGroup")
|
||||
public String findGroup(KeycloakAuthenticationToken token, Model model) {
|
||||
public String findGroup(KeycloakAuthenticationToken token, Model model, @RequestParam(value = "suchbegriff", required = false) String suchbegriff) throws EventException {
|
||||
List<Group> groupse = new ArrayList<>();
|
||||
if(suchbegriff!=null) {
|
||||
groupse = groupService.findGroupWith(suchbegriff);
|
||||
}
|
||||
model.addAttribute("account", keyCloakService.createAccountFromPrincipal(token));
|
||||
model.addAttribute("gruppen",groups);
|
||||
model.addAttribute("gruppen",groupse);
|
||||
return "search";
|
||||
}
|
||||
|
||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin", "ROLE_actuator)"})
|
||||
@PostMapping("/findGroup")
|
||||
public String searchGroup(KeycloakAuthenticationToken token, Model model, @RequestParam(value = "suchbegriff") String suchbegriff) throws EventException {
|
||||
model.addAttribute("account", keyCloakService.createAccountFromPrincipal(token));
|
||||
groups = groupService.findGroupWith(suchbegriff);
|
||||
return "redirect:/gruppen2/findGroup";
|
||||
}
|
||||
|
||||
@PostMapping("/createGroup")
|
||||
public String pCreateGroup(KeycloakAuthenticationToken token,
|
||||
@RequestParam(value = "title") String title,
|
||||
@ -102,10 +98,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");
|
||||
|
||||
@ -26,27 +26,39 @@
|
||||
</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">
|
||||
<span class="badge badge-pill badge-dark" style="background: darkslategray" th:if="${group.getVisibility() == group.getVisibility().PUBLIC }">Private Gruppe</span>
|
||||
<span class="badge badge-pill badge-primary" th:if="${group.getVisibility() == group.getVisibility().PRIVATE}">Ö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-danger" type="danger" style="border-style: none;">Gruppe verlassen</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-3" style="white-space: nowrap">
|
||||
<div>
|
||||
<h2 style="display: inline-block; margin: 0">Mitglieder</h2>
|
||||
<button class="btn btn-secondary" type="warning" style="background: slategrey; float: right" >Mitglieder bearbeiten</button>
|
||||
<p></p>
|
||||
</div>
|
||||
<div>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
|
||||
@ -29,11 +29,11 @@
|
||||
<div class="row">
|
||||
<h1>Gruppensuche</h1>
|
||||
<div class="container-fluid">
|
||||
<form action="/gruppen2/findGroup" method="post">
|
||||
<form action="/gruppen2/findGroup" method="get">
|
||||
<div style="border: 10px solid aliceblue; background: aliceblue">
|
||||
<div class="form-group">
|
||||
<label>Suchbegriff:</label>
|
||||
<input class="form-control" placeholder="z.B. Programmieren, Lerngruppe, ..." th:name="suchbegriff" type="text">
|
||||
<label for="suchleiste">Suchbegriff:</label>
|
||||
<input id="suchleiste" class="form-control" placeholder="z.B. Programmieren, Lerngruppe, ..." th:name="suchbegriff" type="text">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary" style="background: #52a1eb; border-style: none">Suchen</button>
|
||||
</div>
|
||||
@ -41,7 +41,7 @@
|
||||
<br>
|
||||
<table class="table">
|
||||
<!-- Erscheint dann, wenn man "Suchen" Button klickt und Ergebnisse angezeigt werden, aber so solls aussehen -->
|
||||
<thead>
|
||||
<thead th:if="${!gruppen.isEmpty()}">
|
||||
<tr>
|
||||
<th scope="col">Gruppenname</th>
|
||||
<th scope="col">Beschreibung</th>
|
||||
|
||||
Reference in New Issue
Block a user