1

add button elements depending on various factors

This commit is contained in:
killerber4t
2020-03-13 16:27:34 +01:00
parent e870733b37
commit 46985ccca7
3 changed files with 18 additions and 11 deletions

View File

@ -14,8 +14,14 @@ public class UpdateRoleEvent extends Event {
Role newRole;
public UpdateRoleEvent(Long event_id, Long group_id, String user_id, Role newRole) {
super(event_id, group_id, user_id);
super(event_id,+ group_id, user_id);
this.newRole = newRole;
}
public UpdateRoleEvent(Long group_id, String user_id, Role newRole) {
super(group_id, user_id);
this.newRole = newRole;
}
}

View File

@ -1,6 +1,7 @@
package mops.gruppen2.service;
import mops.gruppen2.domain.GroupType;
import mops.gruppen2.domain.Role;
import mops.gruppen2.domain.Visibility;
import mops.gruppen2.domain.event.*;
import mops.gruppen2.security.Account;
@ -20,10 +21,12 @@ public class ControllerService {
AddUserEvent addUserEvent = new AddUserEvent(eventService.checkGroup(), account.getName(),account.getGivenname(),account.getFamilyname(),account.getEmail());
UpdateGroupTitleEvent updateGroupTitleEvent = new UpdateGroupTitleEvent(eventService.checkGroup(), account.getName(), title);
UpdateGroupDescriptionEvent updateGroupDescriptionEvent = new UpdateGroupDescriptionEvent(eventService.checkGroup(), account.getName(), beschreibung);
UpdateRoleEvent updateRoleEvent = new UpdateRoleEvent(eventService.checkGroup(),account.getName(), Role.ADMIN);
eventService.saveEvent(createGroupEvent);
eventService.saveEvent(addUserEvent);
eventService.saveEvent(updateGroupTitleEvent);
eventService.saveEvent(updateGroupDescriptionEvent);
eventService.saveEvent(updateRoleEvent);
}
}

View File

@ -12,10 +12,10 @@
<header>
<nav class="navigation navigation-secondary" is="mops-navigation" th:fragment="navigation">
<ul>
<li>
<li class="active">
<a th:href="@{/gruppen2}" href="/">Gruppen</a>
</li>
<li class="active">
<li>
<a th:href="@{/gruppen2/createGroup}" href="/createGroup">Erstellen</a>
</li>
<li>
@ -29,24 +29,22 @@
<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" th:switch="${group.getVisibility()}">
<a th:case="${group.getVisibility().PRIVATE}">Private Gruppe</a>
<a th:case="${group.getVisibility().PUBLIC}">Öffentliche Gruppe</a>
<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 th:switch="${role.name()}">
<div th:case="'ADMIN'">
<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:case="'MEMBER'">
<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>
</form>
</div>