add button elements depending on various factors
This commit is contained in:
@ -14,8 +14,14 @@ public class UpdateRoleEvent extends Event {
|
|||||||
Role newRole;
|
Role newRole;
|
||||||
|
|
||||||
public UpdateRoleEvent(Long event_id, Long group_id, String user_id, 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;
|
this.newRole = newRole;
|
||||||
}
|
}
|
||||||
|
public UpdateRoleEvent(Long group_id, String user_id, Role newRole) {
|
||||||
|
super(group_id, user_id);
|
||||||
|
|
||||||
|
this.newRole = newRole;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package mops.gruppen2.service;
|
package mops.gruppen2.service;
|
||||||
|
|
||||||
import mops.gruppen2.domain.GroupType;
|
import mops.gruppen2.domain.GroupType;
|
||||||
|
import mops.gruppen2.domain.Role;
|
||||||
import mops.gruppen2.domain.Visibility;
|
import mops.gruppen2.domain.Visibility;
|
||||||
import mops.gruppen2.domain.event.*;
|
import mops.gruppen2.domain.event.*;
|
||||||
import mops.gruppen2.security.Account;
|
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());
|
AddUserEvent addUserEvent = new AddUserEvent(eventService.checkGroup(), account.getName(),account.getGivenname(),account.getFamilyname(),account.getEmail());
|
||||||
UpdateGroupTitleEvent updateGroupTitleEvent = new UpdateGroupTitleEvent(eventService.checkGroup(), account.getName(), title);
|
UpdateGroupTitleEvent updateGroupTitleEvent = new UpdateGroupTitleEvent(eventService.checkGroup(), account.getName(), title);
|
||||||
UpdateGroupDescriptionEvent updateGroupDescriptionEvent = new UpdateGroupDescriptionEvent(eventService.checkGroup(), account.getName(), beschreibung);
|
UpdateGroupDescriptionEvent updateGroupDescriptionEvent = new UpdateGroupDescriptionEvent(eventService.checkGroup(), account.getName(), beschreibung);
|
||||||
|
UpdateRoleEvent updateRoleEvent = new UpdateRoleEvent(eventService.checkGroup(),account.getName(), Role.ADMIN);
|
||||||
|
|
||||||
eventService.saveEvent(createGroupEvent);
|
eventService.saveEvent(createGroupEvent);
|
||||||
eventService.saveEvent(addUserEvent);
|
eventService.saveEvent(addUserEvent);
|
||||||
eventService.saveEvent(updateGroupTitleEvent);
|
eventService.saveEvent(updateGroupTitleEvent);
|
||||||
eventService.saveEvent(updateGroupDescriptionEvent);
|
eventService.saveEvent(updateGroupDescriptionEvent);
|
||||||
|
eventService.saveEvent(updateRoleEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,10 +12,10 @@
|
|||||||
<header>
|
<header>
|
||||||
<nav class="navigation navigation-secondary" is="mops-navigation" th:fragment="navigation">
|
<nav class="navigation navigation-secondary" is="mops-navigation" th:fragment="navigation">
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li class="active">
|
||||||
<a th:href="@{/gruppen2}" href="/">Gruppen</a>
|
<a th:href="@{/gruppen2}" href="/">Gruppen</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="active">
|
<li>
|
||||||
<a th:href="@{/gruppen2/createGroup}" href="/createGroup">Erstellen</a>
|
<a th:href="@{/gruppen2/createGroup}" href="/createGroup">Erstellen</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@ -29,24 +29,22 @@
|
|||||||
<form action="/" method="get">
|
<form action="/" method="get">
|
||||||
<div style="border: 10px solid aliceblue; background: aliceblue">
|
<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" th:switch="${group.getVisibility()}">
|
<a th:if="${group.getVisibility() == group.getVisibility().PUBLIC }">Private Gruppe</a>
|
||||||
<a th:case="${group.getVisibility().PRIVATE}">Private Gruppe</a>
|
<a th:if="${group.getVisibility() == group.getVisibility().PRIVATE}">Öffentliche Gruppe</a>
|
||||||
<a th:case="${group.getVisibility().PUBLIC}">Öffentliche Gruppe</a>
|
|
||||||
</p>
|
</p>
|
||||||
<p th:text="${group.getDescription()}"></p>
|
<p th:text="${group.getDescription()}"></p>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div th:switch="${role.name()}">
|
<div >
|
||||||
<div th:case="'ADMIN'">
|
<div th:if="${role == role.ADMIN}">
|
||||||
<button class="btn btn-primary" type="warning">Gruppenmitglieder bearbeiten</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>
|
<button class="btn btn-primary" type="danger" style="background: #52a1eb; border-style: none">Gruppe verlassen</button>
|
||||||
</div>
|
</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>
|
<button class="btn btn-primary" type="danger" style="background: #52a1eb; border-style: none">Gruppe verlassen</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<-->
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user