Merge pull request #73 from hhu-propra2/fix-search
fix problem where search was keeping same search throughout session a…
This commit is contained in:
@ -70,18 +70,14 @@ public class Gruppen2Controller {
|
|||||||
|
|
||||||
@RolesAllowed({"ROLE_orga", "ROLE_studentin", "ROLE_actuator)"})
|
@RolesAllowed({"ROLE_orga", "ROLE_studentin", "ROLE_actuator)"})
|
||||||
@GetMapping("/findGroup")
|
@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 {
|
||||||
model.addAttribute("account", keyCloakService.createAccountFromPrincipal(token));
|
List<Group> groupse = new ArrayList<>();
|
||||||
model.addAttribute("gruppen",groups);
|
if(suchbegriff!=null) {
|
||||||
return "search";
|
groupse = groupService.findGroupWith(suchbegriff);
|
||||||
}
|
}
|
||||||
|
|
||||||
@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));
|
model.addAttribute("account", keyCloakService.createAccountFromPrincipal(token));
|
||||||
groups = groupService.findGroupWith(suchbegriff);
|
model.addAttribute("gruppen",groupse);
|
||||||
return "redirect:/gruppen2/findGroup";
|
return "search";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/createGroup")
|
@PostMapping("/createGroup")
|
||||||
@ -102,10 +98,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");
|
||||||
|
|||||||
@ -26,28 +26,40 @@
|
|||||||
</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>
|
<span class="badge badge-pill badge-dark" style="background: darkslategray" th:if="${group.getVisibility() == group.getVisibility().PUBLIC }">Private Gruppe</span>
|
||||||
<a th:if="${group.getVisibility() == group.getVisibility().PRIVATE}">Öffentliche Gruppe</a>
|
<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>
|
||||||
<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" 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>
|
||||||
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@ -29,11 +29,11 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<h1>Gruppensuche</h1>
|
<h1>Gruppensuche</h1>
|
||||||
<div class="container-fluid">
|
<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 style="border: 10px solid aliceblue; background: aliceblue">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Suchbegriff:</label>
|
<label for="suchleiste">Suchbegriff:</label>
|
||||||
<input class="form-control" placeholder="z.B. Programmieren, Lerngruppe, ..." th:name="suchbegriff" type="text">
|
<input id="suchleiste" class="form-control" placeholder="z.B. Programmieren, Lerngruppe, ..." th:name="suchbegriff" type="text">
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-primary" style="background: #52a1eb; border-style: none">Suchen</button>
|
<button type="submit" class="btn btn-primary" style="background: #52a1eb; border-style: none">Suchen</button>
|
||||||
</div>
|
</div>
|
||||||
@ -41,7 +41,7 @@
|
|||||||
<br>
|
<br>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<!-- Erscheint dann, wenn man "Suchen" Button klickt und Ergebnisse angezeigt werden, aber so solls aussehen -->
|
<!-- Erscheint dann, wenn man "Suchen" Button klickt und Ergebnisse angezeigt werden, aber so solls aussehen -->
|
||||||
<thead>
|
<thead th:if="${!gruppen.isEmpty()}">
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Gruppenname</th>
|
<th scope="col">Gruppenname</th>
|
||||||
<th scope="col">Beschreibung</th>
|
<th scope="col">Beschreibung</th>
|
||||||
|
|||||||
Reference in New Issue
Block a user