1

"finish" service refactor + fix obvious bugs after refactor (everything should run pretty much)

This commit is contained in:
Christoph
2020-04-08 20:48:42 +02:00
parent 9da2d51897
commit 482dde7960
48 changed files with 655 additions and 520 deletions

View File

@ -30,7 +30,7 @@
<a href="/createStudent" th:href="@{/gruppen2/createStudent}">Erstellen</a>
</li>
<li>
<a href="/findGroup" th:href="@{/gruppen2/findGroup}">Suche</a>
<a href="/searchPage" th:href="@{/gruppen2/searchPage}">Suche</a>
</li>
</ul>
</nav>

View File

@ -31,7 +31,7 @@
<a href="/createStudent" th:href="@{/gruppen2/createStudent}">Erstellen</a>
</li>
<li>
<a th:href="@{/gruppen2/findGroup}" href="/findGroup">Suche</a>
<a th:href="@{/gruppen2/searchPage}" href="/searchPage">Suche</a>
</li>
</ul>
</nav>
@ -53,31 +53,33 @@
<textarea class="form-control" id="description" required rows="3" th:name="description"></textarea>
</div>
<div class="custom-control custom-checkbox">
<!--DO NOT WRAP-->
<input type="hidden" name="maxInfiniteUsers" value="0"/><input class="custom-control-input" type="checkbox" id="maxInfiniteUsers" onclick="this.previousSibling.value=1-this.previousSibling.value"/>
<!--DUMMY-->
<input type="hidden" id="maxInfiniteUsersDummy" name="maxInfiniteUsers" value="0"/>
<input class="custom-control-input" type="checkbox" id="maxInfiniteUsers" onchange="$('#maxInfiniteUsersDummy').val(this.checked ? 1 : 0)"/>
<label class="custom-control-label" for="maxInfiniteUsers">Anzahl
unbegrenzt</label>
</div>
<div class="form-group mt-3" id="userMaximum">
<label for="userMaximum">Teilnehmeranzahl</label>
<input class="form-control" th:name="userMaximum" type="number" min="1" max="100000" value="1">
<input class="form-control" id="userMax" th:name="userMaximum" type="number" min="1" max="100000" value="1">
</div>
<div class="custom-control custom-checkbox" id="privateCheckbox">
<!--DO NOT WRAP-->
<input type="hidden" name="visibility" value="0"/><input class="custom-control-input" type="checkbox" id="visibility" onclick="this.previousSibling.value=1-this.previousSibling.value"/>
<!--DUMMY-->
<input type="hidden" id="visibilityDummy" name="visibility" value="0"/>
<input class="custom-control-input" type="checkbox" id="visibility" onchange="$('#visibilityDummy').val(this.checked ? 1 : 0)"/>
<label class="custom-control-label" for="visibility">Privat</label>
</div>
<div class="custom-control custom-checkbox" id="lectureCheckbox">
<!--DO NOT WRAP-->
<input type="hidden" name="lecture" value="0"/><input class="custom-control-input" type="checkbox" id="lecture" onclick="this.previousSibling.value=1-this.previousSibling.value"/>
<!--DUMMY-->
<input type="hidden" id="lectureDummy" name="lecture" value="0"/>
<input class="custom-control-input" type="checkbox" id="lecture" onchange="$('#lectureDummy').val(this.checked ? 1 : 0)"/>
<label class="custom-control-label" for="lecture">Veranstaltung</label>
</div>
<div class="form-group" id="lectureParent">
<label for="parent"></label>
<div class="form-group mt-3" id="lectureParent">
<label for="parent">Veranstaltungszugehörigkeit</label>
<select class="form-control" id="parent" th:name="parent">
<option disabled selected>--Bitte Veranstaltung auswählen--
</option>
<option th:each="lecture : ${lectures}" th:name="parent" th:value="${lecture.getId()}" th:text="${lecture.getTitle()}"></option>
<option value="" selected>--Keine--</option>
<option th:each="lecture : ${lectures}" name="parent" th:value="${lecture.getId()}" th:text="${lecture.getTitle()}"></option>
</select>
</div>
<div class="form-group pt-4">
@ -105,7 +107,6 @@
</div>
<script>
//TODO: Hab ich kaputt gemacht
// Add the following code if you want the name of the file appear on select
$(".custom-file-input").on("change", function () {
const fileName = $(this).val().split("\\").pop();
@ -115,28 +116,28 @@
// Collapse lectureParent if lecture
$(document).ready(function () {
$('#lecture').change(function () {
$('#lectureParent').prop('disabled', function (i, v) { return !v; });
$('#parent').prop('disable', function (i, v) { return !v; });
});
});
// Collapse provateCheckbox if lecture
$(document).ready(function () {
$('#lecture').change(function () {
$('#privateCheckbox').prop('disabled', function (i, v) { return !v; });
$('#visibility').prop('disabled', function (i, v) { return !v; });
});
});
// Collapse lectureCheckbox if private
$(document).ready(function () {
$('#visibility').change(function () {
$('#lectureCheckbox').prop('disabled', function (i, v) { return !v; });
$('#lecture').prop('disabled', function (i, v) { return !v; });
});
});
// Collapse userMaximum if infinite
$(document).ready(function () {
$('#maxInfiniteUsers').change(function () {
$('#userMaximum').prop('disabled', function (i, v) { return !v; });
$('#userMax').prop('readonly', function (i, v) { return !v; });
});
});
</script>

View File

@ -27,7 +27,7 @@
<a href="/createStudent" th:href="@{/gruppen2/createStudent}">Erstellen</a>
</li>
<li>
<a th:href="@{/gruppen2/findGroup}" href="/findGroup">Suche</a>
<a th:href="@{/gruppen2/searchPage}" href="/searchPage">Suche</a>
</li>
</ul>
</nav>
@ -50,8 +50,9 @@
<textarea class="form-control" id="description" required rows="3" th:name="description"></textarea>
</div>
<div class="custom-control custom-checkbox">
<!--DO NOT WRAP-->
<input type="hidden" name="maxInfiniteUsers" value="0"/><input class="custom-control-input" type="checkbox" id="maxInfiniteUsers" onclick="this.previousSibling.value=1-this.previousSibling.value"/>
<!--DUMMY-->
<input type="hidden" id="maxInfiniteUsersDummy" name="maxInfiniteUsers" value="0"/>
<input class="custom-control-input" type="checkbox" id="maxInfiniteUsers" onchange="$('#maxInfiniteUsersDummy').val(this.checked ? 1 : 0)"/>
<label class="custom-control-label" for="maxInfiniteUsers">Anzahl
unbegrenzt</label>
</div>
@ -61,15 +62,15 @@
type="number" min="1" max="10000">
</div>
<div class="custom-control custom-checkbox">
<!--DO NOT WRAP-->
<input type="hidden" name="visibility" value="0"/><input class="custom-control-input" type="checkbox" id="visibility" onclick="this.previousSibling.value=1-this.previousSibling.value"/>
<!--DUMMY-->
<input type="hidden" id="visibilityDummy" name="visibility" value="0"/>
<input class="custom-control-input" type="checkbox" id="visibility" onchange="$('#visibilityDummy').val(this.checked ? 1 : 0)"/>
<label class="custom-control-label" for="visibility">Privat</label>
</div>
<div class="form-group" id="lectureParent">
<label for="parent"></label>
<label for="parent">Veranstaltungszugehörigkeit</label>
<select class="form-control" id="parent" name="parent">
<option disabled selected>--Bitte Veranstaltung auswählen--
</option>
<option value="" selected>--Keine--</option>
<option th:each="lecture : ${lectures}" th:name="parent" th:value="${lecture.getId()}" th:text="${lecture.getTitle()}">
</option>
</select>

View File

@ -24,7 +24,7 @@
<a href="/createStudent" th:href="@{/gruppen2/createStudent}">Erstellen</a>
</li>
<li>
<a href="/findGroup" th:href="@{/gruppen2/findGroup}">Suche</a>
<a href="/searchPage" th:href="@{/gruppen2/searchPage}">Suche</a>
</li>
</ul>
</nav>
@ -54,7 +54,7 @@
<span class="badge badge-pill badge-success" style="background: lightseagreen"
th:if='${group.getType() == group.getType().LECTURE}'>Veranstaltung</span>
<span class="badge badge-pill badge-info" style="background: mediumorchid"
th:text="${parent.getTitle()}">Parent</span>
th:text="${parent?.getTitle()}">Parent</span>
<div class="input-group mb-3" style="margin-top: 10px"
th:if="${roles.get(user.getId()) == admin}">

View File

@ -22,59 +22,29 @@
<a href="/createStudent" th:href="@{/gruppen2/createStudent}">Erstellen</a>
</li>
<li class="active">
<a th:href="@{/gruppen2/findGroup}" href="/findGroup">Suche</a>
<a th:href="@{/gruppen2/searchPage}" href="/searchPage">Suche</a>
</li>
</ul>
</nav>
</header>
<main th:fragment="bodycontent">
<div class="container-fluid">
<div class="row">
<div class="col-9">
<div class="shadow-sm p-4" style="border: 1px solid aliceblue; border-radius: 5px; background: aliceblue">
<h1 style="color: black; font-weight: bold; font-optical-sizing: auto; overflow-wrap: break-word" th:text="${group.getTitle()}"></h1>
<h3>
<div class="shadow-sm p-4" style="border: 1px solid aliceblue; border-radius: 5px; background: aliceblue">
<h1 style="color: black; font-weight: bold; font-optical-sizing: auto; overflow-wrap: break-word" th:text="${group.getTitle()}"></h1>
<h3>
<span class="badge badge-pill badge-dark" style="background: darkslategray"
th:if='${group.getVisibility() == group.getVisibility().PRIVATE }'>Private Gruppe</span>
<span class="badge badge-pill badge-primary" style="background: #52a1eb"
th:if="${group.getVisibility() == group.getVisibility().PUBLIC}">Öffentliche Gruppe</span>
<span class="badge badge-pill badge-success"
style="background: lightseagreen"
th:if='${group.getType() == group.getType().LECTURE}'> Veranstaltung</span>
<span class="badge badge-pill badge-info" style="background: mediumorchid"
th:text="${parent.getTitle()}">Parent</span>
</h3>
<div class="shadow-sm p-4" style="background: white">
<p style="overflow-wrap: break-word; font-optical-sizing: auto"
th:text="${group.getDescription()}"></p>
</div>
<div class="form-group mt-2">
<div class="text-right">
<form method="post" th:action="@{/gruppen2/detailsBeitreten}">
<button class="btn btn-primary"
style="background: #52a1eb; border-style: none;"
th:href="@{/gruppen2/detailsBeitreten}"
th:name="id" th:value="${group.getId()}"
type="submit">Gruppe beitreten
</button>
</form>
</div>
</div>
</div>
</div>
<div class="col-3" style="white-space: nowrap">
<div style="display: inline-block; margin: 0">
<h2>Mitglieder</h2>
<div th:switch="${group.getUserLimit() != 100000}">
<h4 th:case="${true}">
<a th:text="${group.getMembers().size()}"></a>
<a>von maximal</a>
<a th:text="${group.getUserLimit()}"></a>
<a>Benutzern.</a>
</h4>
<h4 th:case="false">unbegrenzte Teilnehmeranzahl</h4>
</div>
</div>
<span class="badge badge-pill badge-primary" style="background: #52a1eb"
th:if="${group.getVisibility() == group.getVisibility().PUBLIC}">Öffentliche Gruppe</span>
<span class="badge badge-pill badge-success"
style="background: lightseagreen"
th:if='${group.getType() == lecture}'> Veranstaltung</span>
<span class="badge badge-pill badge-info" style="background: mediumorchid"
th:text="${parent?.getTitle()}">Parent</span>
</h3>
<div class="shadow-sm p-4" style="background: white">
<p style="overflow-wrap: break-word; font-optical-sizing: auto"
th:text="${group.getDescription()}"></p>
</div>
</div>
</div>

View File

@ -27,7 +27,7 @@
<a href="/createStudent" th:href="@{/gruppen2/createStudent}">Erstellen</a>
</li>
<li>
<a th:href="@{/gruppen2/findGroup}" href="/findGroup">Suche</a>
<a th:href="@{/gruppen2/searchPage}" href="/searchPage">Suche</a>
</li>
</ul>
</nav>
@ -37,6 +37,7 @@
<div class="row">
<div class="col-10">
<h1>Mitglieder bearbeiten</h1>
<!--TODO: Anzeige bei unbegrenzt-->
<div th:switch="${group.getUserLimit() != 100000}">
<h5 th:case="${true}">
<a th:text="${group.getMembers().size()}"></a>

View File

@ -23,7 +23,7 @@
<a href="/createStudent" th:href="@{/gruppen2/createStudent}">Erstellen</a>
</li>
<li>
<a href="/findGroup" th:href="@{/gruppen2/findGroup}">Suche</a>
<a href="/searchPage" th:href="@{/gruppen2/searchPage}">Suche</a>
</li>
</ul>
</nav>
@ -50,7 +50,7 @@
<h3 style="color: dodgerblue; font-weight: bold; font-optical-sizing: auto; overflow-wrap: break-word">
<span class="badge badge-pill badge-success"
style="background: lightseagreen; margin-right: 25px; float: right"
th:if='${gruppe.getType() == gruppe.getType().LECTURE}'>Veranstaltung</span>
th:if='${gruppe.getType() == lecture}'>Veranstaltung</span>
<a th:href="@{/gruppen2/details/{id}(id=${gruppe.getId()})}"
th:text="${gruppe.getTitle()}"></a>
</h3>

View File

@ -10,6 +10,7 @@
</th:block>
</head>
<body>
<header>
<nav class="navigation navigation-secondary" is="mops-navigation" th:fragment="navigation"
th:switch="${account.getRoles().contains('orga')}">
@ -24,56 +25,44 @@
<a href="/createStudent" th:href="@{/gruppen2/createStudent}">Erstellen</a>
</li>
<li class="active">
<a href="/findGroup" th:href="@{/gruppen2/findGroup}">Suche</a>
<a href="/searchPage" th:href="@{/gruppen2/searchPage}">Suche</a>
</li>
</ul>
</nav>
</header>
<main th:fragment="bodycontent">
<div class="container-fluid">
<div class="row">
<div class="col-9">
<div class="shadow-sm p-4"
style="border: 1px solid aliceblue; border-radius: 5px; background: aliceblue">
<h1 style="color: black; font-weight: bold; font-optical-sizing: auto; overflow-wrap: break-word"
th:text="${group.getTitle()}"></h1>
<h3>Möchtest du dieser privaten Gruppe beitreten?</h3>
<div class="shadow-sm p-4" style="background: white">
<p style="overflow-wrap: break-word; font-optical-sizing: auto"
th:text="${group.getDescription()}"></p>
</div>
<div class="form-group mt-2">
<div class="text-right">
<form method="post" th:action="@{/gruppen2/acceptinvite}">
<input name="id" th:value="${group.getId()}" type="hidden"/>
<button class="btn btn-primary"
style="background: #52a1eb; border-style: none;"
type="submit">Ja, Gruppe beitreten
</button>
<a class="btn btn-primary"
href="/gruppen2"
style="background: #52a1eb; border-style: none;"
type="submit">Ich will das nicht.
</a>
</form>
</div>
</div>
</div>
</div>
<div class="col-3" style="white-space: nowrap">
<div style="display: inline-block; margin: 0">
<h2>Mitglieder</h2>
<div th:switch="${group.getUserLimit() != 100000}">
<h4 th:case="${true}">
<a th:text="${group.getMembers().size()}"></a>
<a>von maximal</a>
<a th:text="${group.getUserLimit()}"></a>
<a>Benutzern.</a>
</h4>
<h4 th:case="false">unbegrenzte Teilnehmeranzahl</h4>
</div>
<div class="shadow-sm p-4"
style="border: 1px solid aliceblue; border-radius: 5px; background: aliceblue">
<h1 style="color: black; font-weight: bold; font-optical-sizing: auto; overflow-wrap: break-word"
th:text="${group.getTitle()}"></h1>
<div class="shadow-sm p-4" style="background: white">
<p style="overflow-wrap: break-word; font-optical-sizing: auto"
th:text="${group.getDescription()}"></p>
</div>
<div class="form-group mt-2" th:if="${group.getMembers().size() < group.getUserLimit()}">
<h3>Möchtest du dieser privaten Gruppe beitreten?</h3>
<div class="text-right">
<form method="post" th:action="@{/gruppen2/acceptinvite}">
<input name="id" th:value="${group.getId()}" type="hidden"/>
<button class="btn btn-primary"
style="background: #52a1eb; border-style: none;"
type="submit">Ja, Gruppe beitreten
</button>
<a class="btn btn-primary"
href="/gruppen2"
style="background: #52a1eb; border-style: none;"
type="submit">Ich will das nicht.
</a>
</form>
</div>
</div>
<h3 class="mt-2" th:if="${group.getMembers().size() >= group.getUserLimit()}">Gruppe ist
voll und
kann nicht
beigetreten
werden.</h3>
</div>
</div>
</main>

View File

@ -23,7 +23,7 @@
<a href="/createStudent" th:href="@{/gruppen2/createStudent}">Erstellen</a>
</li>
<li class="active">
<a th:href="@{/gruppen2/findGroup}" href="/findGroup">Suche</a>
<a th:href="@{/gruppen2/searchPage}" href="/searchPage">Suche</a>
</li>
</ul>
</nav>
@ -35,7 +35,7 @@
<h1>Gruppensuche</h1>
<div class="shadow-sm p-2"
style="border: 10px solid aliceblue; border-radius: 5px; background: aliceblue">
<form method="get" th:action="@{/gruppen2/findGroup}">
<form method="get" th:action="@{/gruppen2/search}">
<div class="form-group">
<label for="suchleiste">Suchbegriff:</label>
<input class="form-control" id="suchleiste"
@ -46,11 +46,9 @@
style="background: #52a1eb; border-style: none"
type="submit">Suchen
</button>
<button class="btn btn-primary"
style="background: deepskyblue; border-style: none"
type="submit">
<a href="/gruppen2/findGroup?suchbegriff=" style="color: white">Alle
anzeigen</a>
<button class="btn btn-primary" style="background: deepskyblue; border-style: none" type="submit">
<a href="/gruppen2/search?suchbegriff=" style="color: white">Alle
anzeigen</a>
</button>
</form>
</div>