fix create page
This commit is contained in:
@ -23,7 +23,6 @@ import javax.annotation.security.RolesAllowed;
|
||||
|
||||
import static mops.gruppen2.service.ControllerService.getGroupType;
|
||||
import static mops.gruppen2.service.ControllerService.getParent;
|
||||
import static mops.gruppen2.service.ControllerService.getUserLimit;
|
||||
|
||||
@SuppressWarnings("SameReturnValue")
|
||||
@Log4j2
|
||||
@ -58,7 +57,6 @@ public class GroupCreationController {
|
||||
@RequestParam("description") String description,
|
||||
@RequestParam("type") String type,
|
||||
@RequestParam(value = "parent", defaultValue = "") String parent,
|
||||
@RequestParam("limit") String limit,
|
||||
@RequestParam("userlimit") long userLimit,
|
||||
@RequestParam(value = "file", required = false) MultipartFile file) {
|
||||
|
||||
@ -69,7 +67,7 @@ public class GroupCreationController {
|
||||
title,
|
||||
description,
|
||||
getGroupType(type),
|
||||
getUserLimit(limit, userLimit),
|
||||
userLimit,
|
||||
getParent(parent, type));
|
||||
|
||||
// ROLE_studentin kann kein CSV importieren
|
||||
|
@ -2,7 +2,6 @@ package mops.gruppen2.service;
|
||||
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import mops.gruppen2.domain.GroupType;
|
||||
import mops.gruppen2.domain.Limit;
|
||||
import net.bytebuddy.description.modifier.Visibility;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -23,19 +22,6 @@ public final class ControllerService {
|
||||
return GroupType.valueOf(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wenn die maximale Useranzahl unendlich ist, wird das Maximum auf 100000 gesetzt.
|
||||
* Praktisch gibt es also maximal 100000 Nutzer pro Gruppe.
|
||||
*
|
||||
* @param limit Gibt an, ob es unendlich viele User geben soll
|
||||
* @param userLimit Das Maximum an Usern, falls es eins gibt
|
||||
*
|
||||
* @return Maximum an Usern
|
||||
*/
|
||||
public static long getUserLimit(String limit, long userLimit) {
|
||||
return Limit.valueOf(limit) == Limit.INFINITE ? Long.MAX_VALUE : userLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ermittelt die UUID des Parents, falls vorhanden.
|
||||
*/
|
||||
|
@ -1,8 +1,4 @@
|
||||
// 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();
|
||||
$(this).siblings(".custom-file-label").addClass("selected").html(fileName);
|
||||
});
|
||||
|
||||
function disable(id) {
|
||||
$(id).prop('disabled', true);
|
||||
|
@ -29,6 +29,12 @@
|
||||
<input type="file" class="custom-file-input" id="file" th:name="file">
|
||||
<label class="custom-file-label" for="file">Datei auswählen</label>
|
||||
</div>
|
||||
<script>
|
||||
$(".custom-file-input").on("change", function () {
|
||||
const fileName = $(this).val().split("\\").pop();
|
||||
$(this).siblings(".custom-file-label").addClass("selected").html(fileName);
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<!--Gruppentyp-->
|
||||
@ -65,12 +71,13 @@
|
||||
<th:block th:fragment="userlimit">
|
||||
<label for="userlimit">Teilnehmeranzahl:</label>
|
||||
<div class="btn-toolbar row mx-0" id="userlimit">
|
||||
<input type="hidden" name="userlimit" id="limit" value="9223372036854775807">
|
||||
<div class="btn-group btn-group-toggle col-sm-4 px-0" data-toggle="buttons">
|
||||
<label class="btn btn-secondary active" onclick="disable('#limitselect')">
|
||||
<input type="radio" name="userlimit" value="9223372036854775807" checked>
|
||||
<label class="btn btn-secondary active" onclick="disable('#limitselect'); enable('#limit')">
|
||||
<input type="radio" checked>
|
||||
Unbegrenzt
|
||||
</label>
|
||||
<label class="btn btn-secondary" onclick="enable('#limitselect')">
|
||||
<label class="btn btn-secondary" onclick="enable('#limitselect'); disable('#limit')">
|
||||
<input type="radio"> Begrenzt
|
||||
</label>
|
||||
</div>
|
||||
|
@ -1,67 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en"
|
||||
th:replace="~{mopslayout :: html(name='Gruppenbildung', headcontent=~{:: headcontent}, navigation=~{:: navigation}, bodycontent=~{:: bodycontent})}"
|
||||
xmlns="http://www.w3.org/1999/html"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Gruppenerstellung</title>
|
||||
<th:block th:fragment="headcontent">
|
||||
<!-- Links, Skripts, Styles hier einfügen! -->
|
||||
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
|
||||
rel="stylesheet">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
|
||||
<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">
|
||||
<ul>
|
||||
<li class="active">
|
||||
<a th:href="@{/gruppen2}">Gruppen</a>
|
||||
</li>
|
||||
<li>
|
||||
<a th:href="@{/gruppen2/create}">Erstellen</a>
|
||||
</li>
|
||||
<li>
|
||||
<a th:href="@{/gruppen2/search}">Suche</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
<main th:fragment="bodycontent">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-10">
|
||||
<h1>Metadaten ändern</h1>
|
||||
<form method="post" th:action="@{/gruppen2/details/{id}/meta/update(id=${group.getId()})}">
|
||||
<div class="shadow-sm p-2"
|
||||
style=" border: 10px solid aliceblue; background: aliceblue;">
|
||||
<div class="form-group">
|
||||
<label for="title">Titel</label>
|
||||
<input class="form-control" id="title" required
|
||||
th:name="title" th:value="${group.getTitle()}" type="text">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="description">Beschreibung</label>
|
||||
<textarea class="form-control" id="description" required rows="3"
|
||||
th:name="description"
|
||||
th:text="${group.getDescription()}"></textarea>
|
||||
</div>
|
||||
<div class="form-group pt-4">
|
||||
<button class="btn btn-primary"
|
||||
style="background: #52a1eb; border-style: none;"
|
||||
th:if="${group.getRoles().get(user.getId()) == admin}"
|
||||
type="submit">Speichern
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user