1

ControllerService + CreationController + GroupService improvements + disabled controllerservice tests, the need to be rewritten

This commit is contained in:
Christoph
2020-04-07 17:58:04 +02:00
parent e13af57ab6
commit 897722fbd7
12 changed files with 331 additions and 364 deletions

View File

@ -2,6 +2,7 @@
<html lang="en" xmlns:th="http://www.thymeleaf.org"
th:replace="~{mopslayout :: html(name='Gruppenbildung', headcontent=~{:: headcontent}, navigation=~{:: navigation}, bodycontent=~{:: bodycontent})}"
xmlns="http://www.w3.org/1999/html">
<head>
<meta charset="utf-8">
<title>Gruppenerstellung</title>
@ -14,7 +15,9 @@
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
</th:block>
</head>
<body>
<header>
<nav class="navigation navigation-secondary" is="mops-navigation" th:fragment="navigation" th:switch="${account.getRoles().contains('orga')}">
<ul>
@ -33,65 +36,58 @@
</ul>
</nav>
</header>
<main th:fragment="bodycontent">
<div class="container-fluid">
<div class="row">
<div class="col-10">
<h1>Gruppenerstellung</h1>
<form enctype="multipart/form-data" method="post"
th:action="@{/gruppen2/createOrga}">
<div class="shadow-sm p-2"
style=" border: 10px solid aliceblue; background: aliceblue">
<form enctype="multipart/form-data" method="post" th:action="@{/gruppen2/createOrga}">
<div class="shadow-sm p-2" style=" border: 10px solid aliceblue; background: aliceblue">
<div class="form-group">
<label for="titel">Titel</label>
<input class="form-control" id="titel" required th:name="title"
type="text">
<input class="form-control" id="titel" required th:name="title" type="text">
</div>
<div class="form-group">
<label for="description">Beschreibung</label>
<textarea class="form-control" id="description" required
rows="3" th:name="description"></textarea>
<textarea class="form-control" id="description" required rows="3" th:name="description"></textarea>
</div>
<div class="custom-control custom-checkbox">
<input class="custom-control-input" id="maxInfiniteUsers" th:name="maxInfiniteUsers"
type="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"/>
<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="10000">
<input class="form-control" th:name="userMaximum" type="number" min="1" max="100000" value="1">
</div>
<div class="custom-control custom-checkbox" id="privateCheckbox">
<input class="custom-control-input" id="visibility" th:name="visibility"
type="checkbox">
<label class="custom-control-label" for="visibility">Private
Gruppe</label>
<!--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"/>
<label class="custom-control-label" for="visibility">Privat</label>
</div>
<div class="custom-control custom-checkbox" id="lectureCheckbox">
<input class="custom-control-input" id="lecture" th:name="lecture"
type="checkbox">
<!--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"/>
<label class="custom-control-label" for="lecture">Veranstaltung</label>
</div>
<div class="form-group" id="lectureParent">
<label for="parent"></label>
<select class="form-control" id="parent" name="parent">
<option disabled selected="true">--Bitte Veranstaltung auswählen--
</option>
<option th:each="lecture : ${lectures}" th:name="parent" th:value="${lecture.getId()}" th:text="${lecture.getTitle()}">
<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>
</select>
</div>
<div class="form-group pt-4">
<div class="row">
<div class="col">
<div class="custom-file">
<input class="custom-file-input" id="file" th:name="file"
type="file">
<label class="custom-file-label" for="file">CSV Datei von
Mitgliedern
hochladen</label>
<input class="custom-file-input" id="file" th:name="file" type="file">
</div>
</div>
</div>
@ -107,38 +103,46 @@
</div>
</div>
</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 () {
var fileName = $(this).val().split("\\").pop();
const fileName = $(this).val().split("\\").pop();
$(this).siblings(".custom-file-label").addClass("selected").html(fileName);
});
// Collapsing lectureParent if lecture is checked
// Collapse lectureParent if lecture
$(document).ready(function () {
$('#lecture').change(function () {
$('#lectureParent').fadeToggle();
$('#lectureParent').prop('disabled', function (i, v) { return !v; });
});
});
// Collapse provateCheckbox if lecture
$(document).ready(function () {
$('#lecture').change(function () {
$('#privateCheckbox').fadeToggle();
$('#privateCheckbox').prop('disabled', function (i, v) { return !v; });
});
});
// Collapse lectureCheckbox if private
$(document).ready(function () {
$('#visibility').change(function () {
$('#lectureCheckbox').fadeToggle();
$('#lectureCheckbox').prop('disabled', function (i, v) { return !v; });
});
});
// Collapse userMaximum if infinite
$(document).ready(function () {
$('#maxInfiniteUsers').change(function () {
$('#userMaximum').fadeToggle();
$('#userMaximum').prop('disabled', function (i, v) { return !v; });
});
});
</script>
</main>
</body>
</html>

View File

@ -43,17 +43,15 @@
<div class="form-group">
<label for="titel">Titel</label>
<input class="form-control" id="titel" required th:name="title"
type="text">
<input class="form-control" id="titel" required th:name="title" type="text">
</div>
<div class="form-group">
<label for="description">Beschreibung</label>
<textarea class="form-control" id="description" required
rows="3" th:name="description"></textarea>
<textarea class="form-control" id="description" required rows="3" th:name="description"></textarea>
</div>
<div class="custom-control custom-checkbox">
<input class="custom-control-input" id="maxInfiniteUsers" th:name="maxInfiniteUsers"
type="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"/>
<label class="custom-control-label" for="maxInfiniteUsers">Anzahl
unbegrenzt</label>
</div>
@ -63,15 +61,14 @@
type="number" min="1" max="10000">
</div>
<div class="custom-control custom-checkbox">
<input class="custom-control-input" id="visibility" th:name="visibility"
type="checkbox">
<label class="custom-control-label" for="visibility">Private
Gruppe</label>
<!--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"/>
<label class="custom-control-label" for="visibility">Privat</label>
</div>
<div class="form-group" id="lectureParent">
<label for="parent"></label>
<select class="form-control" id="parent" name="parent">
<option disabled selected="true">--Bitte Veranstaltung auswählen--
<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>