Merge remote-tracking branch 'origin/UI-Improvements'
# Conflicts: # src/main/java/mops/gruppen2/controller/Gruppen2Controller.java # src/main/resources/templates/detailsMember.html
This commit is contained in:
@ -33,7 +33,6 @@ public class Gruppen2Controller {
|
|||||||
private final GroupService groupService;
|
private final GroupService groupService;
|
||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
private final ControllerService controllerService;
|
private final ControllerService controllerService;
|
||||||
private List<Group> groups = new ArrayList<>();
|
|
||||||
|
|
||||||
public Gruppen2Controller(KeyCloakService keyCloakService, EventService eventService, GroupService groupService, UserService userService, ControllerService controllerService) {
|
public Gruppen2Controller(KeyCloakService keyCloakService, EventService eventService, GroupService groupService, UserService userService, ControllerService controllerService) {
|
||||||
this.keyCloakService = keyCloakService;
|
this.keyCloakService = keyCloakService;
|
||||||
@ -58,6 +57,7 @@ public class Gruppen2Controller {
|
|||||||
|
|
||||||
model.addAttribute("account", keyCloakService.createAccountFromPrincipal(token));
|
model.addAttribute("account", keyCloakService.createAccountFromPrincipal(token));
|
||||||
model.addAttribute("gruppen", userService.getUserGroups(user.getUser_id()));
|
model.addAttribute("gruppen", userService.getUserGroups(user.getUser_id()));
|
||||||
|
model.addAttribute("user",user);
|
||||||
return "index";
|
return "index";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,10 +83,12 @@ 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);
|
if (visibility == null) visibility=false;
|
||||||
|
controllerService.createGroup(account, title, beschreibung, visibility);
|
||||||
|
|
||||||
return "redirect:/gruppen2/";
|
return "redirect:/gruppen2/";
|
||||||
}
|
}
|
||||||
@ -100,7 +102,7 @@ public class Gruppen2Controller {
|
|||||||
User user = new User(account.getName(), account.getGivenname(), account.getFamilyname(), account.getEmail());
|
User user = new User(account.getName(), account.getGivenname(), account.getFamilyname(), account.getEmail());
|
||||||
if(group!= null) {
|
if(group!= null) {
|
||||||
model.addAttribute("group", group);
|
model.addAttribute("group", group);
|
||||||
model.addAttribute("role",group.getRoles().get(user.getUser_id()));
|
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");
|
||||||
|
|||||||
@ -27,10 +27,15 @@ public class ControllerService {
|
|||||||
* @param title Gruppentitel
|
* @param title Gruppentitel
|
||||||
* @param description Gruppenbeschreibung
|
* @param description Gruppenbeschreibung
|
||||||
*/
|
*/
|
||||||
public void createGroup(Account account, String title, String description) {
|
public void createGroup(Account account, String title, String description, Boolean visibility) {
|
||||||
|
Visibility visibility1;
|
||||||
|
if (visibility){
|
||||||
|
visibility1 = Visibility.PUBLIC;
|
||||||
|
}else{
|
||||||
|
visibility1 = Visibility.PRIVATE;
|
||||||
|
}
|
||||||
List<Event> eventList = new ArrayList<>();
|
List<Event> eventList = new ArrayList<>();
|
||||||
Collections.addAll(eventList, new CreateGroupEvent(eventService.checkGroup(), account.getName(), null , GroupType.LECTURE, Visibility.PUBLIC),
|
Collections.addAll(eventList, new CreateGroupEvent(eventService.checkGroup(), account.getName(), null , GroupType.LECTURE, visibility1),
|
||||||
new AddUserEvent(eventService.checkGroup(), account.getName(),account.getGivenname(),account.getFamilyname(),account.getEmail()),
|
new AddUserEvent(eventService.checkGroup(), account.getName(),account.getGivenname(),account.getFamilyname(),account.getEmail()),
|
||||||
new UpdateRoleEvent(eventService.checkGroup(), account.getName(), Role.ADMIN),
|
new UpdateRoleEvent(eventService.checkGroup(), account.getName(), Role.ADMIN),
|
||||||
new UpdateGroupTitleEvent(eventService.checkGroup(), account.getName(), title),
|
new UpdateGroupTitleEvent(eventService.checkGroup(), account.getName(), title),
|
||||||
|
|||||||
@ -29,7 +29,7 @@
|
|||||||
<h1>Gruppenerstellung</h1>
|
<h1>Gruppenerstellung</h1>
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<form method="post" action="/gruppen2/createGroup">
|
<form method="post" action="/gruppen2/createGroup">
|
||||||
<div class="shadow p-2" style="border: 10px solid aliceblue; background: aliceblue">
|
<div class="shadow p-2" style=" border: 10px solid aliceblue; background: aliceblue">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="titel">Titel</label>
|
<label for="titel">Titel</label>
|
||||||
<input type="text" class="form-control" id="titel" th:name="title" required>
|
<input type="text" class="form-control" id="titel" th:name="title" required>
|
||||||
@ -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>
|
||||||
|
|||||||
@ -43,6 +43,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-3" style="white-space: nowrap">
|
<div class="col-3" style="white-space: nowrap">
|
||||||
<div>
|
<div>
|
||||||
<h2 style="display: inline-block; margin: 0">Mitglieder</h2>
|
<h2 style="display: inline-block; margin: 0">Mitglieder</h2>
|
||||||
|
|||||||
@ -25,19 +25,35 @@
|
|||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
<main th:fragment="bodycontent">
|
<main th:fragment="bodycontent">
|
||||||
<h1>Meine Gruppen</h1>
|
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<form action="/" method="get">
|
<div class="row" >
|
||||||
<div th:each="gruppe: ${gruppen}">
|
<div class="col-9">
|
||||||
<div style="border: 10px solid aliceblue; background: aliceblue">
|
<h1>Meine Gruppen</h1>
|
||||||
<h3>
|
<form action="/" method="get">
|
||||||
<a th:href="@{/gruppen2/details(id=${gruppe.getId()})}" style="color: dodgerblue; font-weight: bold" th:text="${gruppe.getTitle()}"></a>
|
<div th:each="gruppe: ${gruppen}">
|
||||||
</h3>
|
<div style="border: 10px solid aliceblue; background: aliceblue">
|
||||||
<p th:text="${gruppe.getDescription()}"></p>
|
<h3>
|
||||||
</div>
|
<a th:href="@{/gruppen2/details(id=${gruppe.getId()})}" style="color: dodgerblue; font-weight: bold" th:text="${gruppe.getTitle()}"></a>
|
||||||
<br>
|
</h3>
|
||||||
|
<p th:text="${gruppe.getDescription()}"></p>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
<div class="col-3" >
|
||||||
|
<div class="container-fluid" style="background: aliceblue">
|
||||||
|
<div>
|
||||||
|
<h2 th:text="${user.getUser_id()}" style="text-align: center">user_id</h2>
|
||||||
|
<h3>
|
||||||
|
<span th:text="${user.getGivenname()}">username</span>
|
||||||
|
<span th:text="${user.getFamilyname()}">usersurname</span>
|
||||||
|
</h3>
|
||||||
|
<small th:text="${user.getEmail()}">usermail</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Reference in New Issue
Block a user