From 437b9cbd43eb1b8e2a7a780ed45ea174f1017ecf Mon Sep 17 00:00:00 2001 From: Jottyfan Date: Wed, 22 Mar 2023 22:37:34 +0100 Subject: [PATCH] finalized for productive deployment --- .settings/org.eclipse.buildship.core.prefs | 11 --- .settings/org.eclipse.wst.common.component | 20 ++--- build.gradle | 2 +- .../module/admin/AdminController.java | 32 ++----- .../business/bookings/BookingsController.java | 19 +--- .../business/business/BusinessController.java | 4 +- .../module/business/camp/CampController.java | 3 +- .../privileges/PrivilegesController.java | 3 +- .../module/camplist/CamplistController.java | 2 - .../module/camplist/CamplistGateway.java | 2 +- .../module/camplist/CommonController.java | 18 ++-- .../confirmation/ConfirmationController.java | 5 +- .../confirmation/person/PersonController.java | 3 +- .../module/document/DocumentController.java | 4 +- .../module/ical/ICalController.java | 4 +- .../module/migration/MigrationController.java | 4 +- .../registration/RegistrationController.java | 12 +-- .../module/rss/RssController.java | 4 +- .../staticpages/AllgemeinesController.java | 23 ----- .../staticpages/DatenschutzController.java | 23 ----- .../staticpages/ImpressumController.java | 23 ----- .../module/staticpages/IndexController.java | 18 ---- .../module/staticpages/KontaktController.java | 23 ----- .../module/staticpages/ReportsController.java | 24 ----- .../staticpages/StaticPagesController.java | 87 +++++++++++++++++++ .../module/staticpages/VereinController.java | 23 ----- src/main/resources/templates/camplist.html | 44 +--------- src/main/resources/templates/dashboard.html | 33 +------ .../templates/fragments/camplist.html | 50 +++++++++++ .../resources/templates/migration/login.html | 71 +++++++-------- src/main/resources/templates/template.html | 34 ++++---- 31 files changed, 248 insertions(+), 380 deletions(-) delete mode 100644 src/main/java/de/jottyfan/camporganizer/module/staticpages/AllgemeinesController.java delete mode 100644 src/main/java/de/jottyfan/camporganizer/module/staticpages/DatenschutzController.java delete mode 100644 src/main/java/de/jottyfan/camporganizer/module/staticpages/ImpressumController.java delete mode 100644 src/main/java/de/jottyfan/camporganizer/module/staticpages/IndexController.java delete mode 100644 src/main/java/de/jottyfan/camporganizer/module/staticpages/KontaktController.java delete mode 100644 src/main/java/de/jottyfan/camporganizer/module/staticpages/ReportsController.java create mode 100644 src/main/java/de/jottyfan/camporganizer/module/staticpages/StaticPagesController.java delete mode 100644 src/main/java/de/jottyfan/camporganizer/module/staticpages/VereinController.java create mode 100644 src/main/resources/templates/fragments/camplist.html diff --git a/.settings/org.eclipse.buildship.core.prefs b/.settings/org.eclipse.buildship.core.prefs index e479558..e889521 100644 --- a/.settings/org.eclipse.buildship.core.prefs +++ b/.settings/org.eclipse.buildship.core.prefs @@ -1,13 +1,2 @@ -arguments= -auto.sync=false -build.scans.enabled=false -connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) connection.project.dir= eclipse.preferences.version=1 -gradle.user.home= -java.home= -jvm.arguments= -offline.mode=false -override.workspace.settings=false -show.console.view=false -show.executions.view=false diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 31a62d0..59fc2ab 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,14 +1,8 @@ - - - - - - - - - - - - - + + + + + + + diff --git a/build.gradle b/build.gradle index 9948f51..88a7ce4 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ apply plugin: 'war' apply plugin: 'application' group = 'de.jottyfan.camporganizer' -version = '0.3.7' +version = '0.3.8' sourceCompatibility = 17 mainClassName = "de.jottyfan.camporganizer.Main" diff --git a/src/main/java/de/jottyfan/camporganizer/module/admin/AdminController.java b/src/main/java/de/jottyfan/camporganizer/module/admin/AdminController.java index 56e2362..69cae31 100644 --- a/src/main/java/de/jottyfan/camporganizer/module/admin/AdminController.java +++ b/src/main/java/de/jottyfan/camporganizer/module/admin/AdminController.java @@ -38,7 +38,6 @@ public class AdminController extends CommonController { @GetMapping("/admin/mail") public String getMail(Model model, HttpServletRequest request) { - super.setupSession(model, request); MailBean mailBean = new MailBean(); mailBean.setFrom(from); mailBean.getTo().add(getCurrentEmail(request)); @@ -49,7 +48,6 @@ public class AdminController extends CommonController { @PostMapping("/admin/mail/send") public String sendMail(@Valid @ModelAttribute("bean") MailBean bean, final BindingResult bindingResult, Model model, HttpServletRequest request) { - super.setupSession(model, request); if (bindingResult.hasErrors()) { for (ObjectError error : bindingResult.getAllErrors()) LOGGER.error("error {}: {}", error.getCode(), error.getDefaultMessage()); @@ -61,29 +59,25 @@ public class AdminController extends CommonController { @GetMapping("/admin/document") public String getDocuments(Model model, HttpServletRequest request) { - super.setupSession(model, request); model.addAttribute("documents", service.getAllDocuments()); return "/admin/document"; } @GetMapping("/admin/document/add") public String prepareAddDocument(Model model, HttpServletRequest request) { - super.setupSession(model, request); model.addAttribute("bean", new DocumentBean()); return "/admin/document_edit"; } @GetMapping("/admin/document/edit/{id}") public String prepareAddDocument(@PathVariable Integer id, Model model, HttpServletRequest request) { - super.setupSession(model, request); model.addAttribute("bean", service.getDocument(id)); return "/admin/document_edit"; } @PostMapping("/admin/document/update") - public String updateDocument(@Valid @ModelAttribute("bean") DocumentBean bean, - final BindingResult bindingResult, Model model, HttpServletRequest request) { - super.setupSession(model, request); + public String updateDocument(@Valid @ModelAttribute("bean") DocumentBean bean, final BindingResult bindingResult, + Model model, HttpServletRequest request) { if (bindingResult.hasErrors()) { for (ObjectError error : bindingResult.getAllErrors()) LOGGER.error("error {}: {}", error.getCode(), error.getDefaultMessage()); @@ -95,21 +89,18 @@ public class AdminController extends CommonController { @GetMapping("/admin/document/delete/{id}") public String deleteDocument(@PathVariable Integer id, Model model, HttpServletRequest request) { - super.setupSession(model, request); service.deleteDocument(id); return "redirect:/admin/document"; } @GetMapping("/admin/location") public String getLocations(Model model, HttpServletRequest request) { - super.setupSession(model, request); model.addAttribute("locations", service.getLocations()); return "/admin/location"; } @GetMapping("/admin/location/add") public String prepareAddLocation(Model model, HttpServletRequest request) { - super.setupSession(model, request); model.addAttribute("bean", new LocationBean()); model.addAttribute("documents", service.getLocationDocuments()); return "/admin/location_edit"; @@ -117,16 +108,14 @@ public class AdminController extends CommonController { @GetMapping("/admin/location/edit/{id}") public String prepareAddLocation(@PathVariable Integer id, Model model, HttpServletRequest request) { - super.setupSession(model, request); model.addAttribute("bean", service.getLocation(id)); model.addAttribute("documents", service.getLocationDocuments()); return "/admin/location_edit"; } @PostMapping("/admin/location/update") - public String updateDocument(@Valid @ModelAttribute("bean") LocationBean bean, - final BindingResult bindingResult, Model model, HttpServletRequest request) { - super.setupSession(model, request); + public String updateDocument(@Valid @ModelAttribute("bean") LocationBean bean, final BindingResult bindingResult, + Model model, HttpServletRequest request) { if (bindingResult.hasErrors()) { for (ObjectError error : bindingResult.getAllErrors()) { LOGGER.error("error {}: {}", error.getCode(), error.getDefaultMessage()); @@ -140,14 +129,12 @@ public class AdminController extends CommonController { @GetMapping("/admin/location/delete/{id}") public String deleteLocation(@PathVariable Integer id, Model model, HttpServletRequest request) { - super.setupSession(model, request); service.deleteLocation(id); return "redirect:/admin/location"; } @GetMapping("/admin/camp") public String getCamplist(Model model, HttpServletRequest request) { - super.setupSession(model, request); model.addAttribute("camps", service.getAllCamps()); model.addAttribute("locations", service.getLocations()); return "/admin/camp"; @@ -155,7 +142,6 @@ public class AdminController extends CommonController { @GetMapping("/admin/camp/add") public String prepareAddCamp(Model model, HttpServletRequest request) { - super.setupSession(model, request); model.addAttribute("bean", new CampBean()); model.addAttribute("documents", service.getCampDocuments()); model.addAttribute("locations", service.getLocations()); @@ -165,7 +151,6 @@ public class AdminController extends CommonController { @GetMapping("/admin/camp/edit/{id}") public String prepareEditCamp(@PathVariable Integer id, Model model, HttpServletRequest request) { - super.setupSession(model, request); model.addAttribute("bean", service.getCamp(id)); model.addAttribute("documents", service.getCampDocuments()); model.addAttribute("locations", service.getLocations()); @@ -178,9 +163,8 @@ public class AdminController extends CommonController { } @PostMapping("/admin/camp/update") - public String updateDocument(@Valid @ModelAttribute("bean") CampBean bean, - final BindingResult bindingResult, Model model, HttpServletRequest request, RedirectAttributes redirect) { - super.setupSession(model, request); + public String updateDocument(@Valid @ModelAttribute("bean") CampBean bean, final BindingResult bindingResult, + Model model, HttpServletRequest request, RedirectAttributes redirect) { if (bindingResult.hasErrors()) { for (ObjectError error : bindingResult.getAllErrors()) { LOGGER.error("error {}: {}", error.getCode(), error.getDefaultMessage()); @@ -198,8 +182,8 @@ public class AdminController extends CommonController { } @GetMapping("/admin/camp/delete/{id}") - public String deleteCamp(@PathVariable Integer id, Model model, HttpServletRequest request, RedirectAttributes redirect) { - super.setupSession(model, request); + public String deleteCamp(@PathVariable Integer id, Model model, HttpServletRequest request, + RedirectAttributes redirect) { String error = service.deleteCamp(id); redirect.addAttribute("error", error); return error != null ? "redirect:/admin/camp/edit/" + id : "redirect:/admin/camp"; diff --git a/src/main/java/de/jottyfan/camporganizer/module/business/bookings/BookingsController.java b/src/main/java/de/jottyfan/camporganizer/module/business/bookings/BookingsController.java index a47e720..9745809 100644 --- a/src/main/java/de/jottyfan/camporganizer/module/business/bookings/BookingsController.java +++ b/src/main/java/de/jottyfan/camporganizer/module/business/bookings/BookingsController.java @@ -1,7 +1,6 @@ package de.jottyfan.camporganizer.module.business.bookings; import javax.annotation.security.RolesAllowed; -import javax.servlet.http.HttpServletRequest; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -16,7 +15,7 @@ import org.springframework.web.bind.annotation.RequestParam; import de.jottyfan.camporganizer.module.business.bookings.impl.AddPaymentBean; import de.jottyfan.camporganizer.module.business.bookings.impl.BookerBean; -import de.jottyfan.camporganizer.module.business.business.IBusinessService; +import de.jottyfan.camporganizer.module.camplist.CommonController; /** * @@ -24,24 +23,16 @@ import de.jottyfan.camporganizer.module.business.business.IBusinessService; * */ @Controller -public class BookingsController { +public class BookingsController extends CommonController { private static final Logger LOGGER = LogManager.getLogger(BookingsController.class); - @Autowired - private HttpServletRequest request; - - @Autowired - private IBusinessService indexService; - @Autowired private IBookingsService bookingsService; @GetMapping("/business/bookings") @RolesAllowed({"business_booking"}) public String getBookings(Model model) { - String username = indexService.getCurrentUser(request); - model.addAttribute("currentUser", username); - model.addAttribute("bookers", bookingsService.getBookers(username)); + model.addAttribute("bookers", bookingsService.getBookers(getCurrentUser())); model.addAttribute("addBean", new AddPaymentBean()); return "business/bookings"; } @@ -49,9 +40,7 @@ public class BookingsController { @GetMapping("/business/bookings/{id}") @RolesAllowed({"business_booking"}) public String getBooking(Model model, @PathVariable Integer id) { - String username = indexService.getCurrentUser(request); - model.addAttribute("currentUser", username); - BookerBean bean = bookingsService.getBooker(id, username); + BookerBean bean = bookingsService.getBooker(id, getCurrentUser()); model.addAttribute("booker", bean); model.addAttribute("addBean", new AddPaymentBean()); return bean == null ? getBookings(model) : "business/booker"; diff --git a/src/main/java/de/jottyfan/camporganizer/module/business/business/BusinessController.java b/src/main/java/de/jottyfan/camporganizer/module/business/business/BusinessController.java index 92bd34a..5352d56 100644 --- a/src/main/java/de/jottyfan/camporganizer/module/business/business/BusinessController.java +++ b/src/main/java/de/jottyfan/camporganizer/module/business/business/BusinessController.java @@ -7,13 +7,15 @@ import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; +import de.jottyfan.camporganizer.module.camplist.CommonController; + /** * * @author jotty * */ @Controller -public class BusinessController { +public class BusinessController extends CommonController { @Autowired private HttpServletRequest request; diff --git a/src/main/java/de/jottyfan/camporganizer/module/business/camp/CampController.java b/src/main/java/de/jottyfan/camporganizer/module/business/camp/CampController.java index 8d17af2..d450889 100644 --- a/src/main/java/de/jottyfan/camporganizer/module/business/camp/CampController.java +++ b/src/main/java/de/jottyfan/camporganizer/module/business/camp/CampController.java @@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import de.jottyfan.camporganizer.module.business.business.IBusinessService; +import de.jottyfan.camporganizer.module.camplist.CommonController; /** * @@ -17,7 +18,7 @@ import de.jottyfan.camporganizer.module.business.business.IBusinessService; * */ @Controller -public class CampController { +public class CampController extends CommonController { @Autowired private HttpServletRequest request; diff --git a/src/main/java/de/jottyfan/camporganizer/module/business/privileges/PrivilegesController.java b/src/main/java/de/jottyfan/camporganizer/module/business/privileges/PrivilegesController.java index c7c443c..3340634 100644 --- a/src/main/java/de/jottyfan/camporganizer/module/business/privileges/PrivilegesController.java +++ b/src/main/java/de/jottyfan/camporganizer/module/business/privileges/PrivilegesController.java @@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.PostMapping; import de.jottyfan.camporganizer.module.business.business.IBusinessService; import de.jottyfan.camporganizer.module.business.privileges.impl.PrivilegesBean; +import de.jottyfan.camporganizer.module.camplist.CommonController; /** * @@ -20,7 +21,7 @@ import de.jottyfan.camporganizer.module.business.privileges.impl.PrivilegesBean; * */ @Controller -public class PrivilegesController { +public class PrivilegesController extends CommonController { @Autowired private HttpServletRequest request; diff --git a/src/main/java/de/jottyfan/camporganizer/module/camplist/CamplistController.java b/src/main/java/de/jottyfan/camporganizer/module/camplist/CamplistController.java index cd8f55c..0b79487 100644 --- a/src/main/java/de/jottyfan/camporganizer/module/camplist/CamplistController.java +++ b/src/main/java/de/jottyfan/camporganizer/module/camplist/CamplistController.java @@ -34,14 +34,12 @@ public class CamplistController extends CommonController { @GetMapping("/camplist") public String index(Model model) { - super.setupSession(model, request); model.addAttribute("camps", service.getAllCamps(true)); return super.isLoggedIn(request) ? dashboard(model) : "/camplist"; } @GetMapping("/dashboard") public String dashboard(Model model) { - super.setupSession(model, request); model.addAttribute("mybookings", service.getBookingsOf(super.getCurrentUser(request))); model.addAttribute("bookingBean", new BookingBean()); model.addAttribute("keycloakProfileUrl", keycloak.getUserClientUrl()); diff --git a/src/main/java/de/jottyfan/camporganizer/module/camplist/CamplistGateway.java b/src/main/java/de/jottyfan/camporganizer/module/camplist/CamplistGateway.java index b8bf19b..699f968 100644 --- a/src/main/java/de/jottyfan/camporganizer/module/camplist/CamplistGateway.java +++ b/src/main/java/de/jottyfan/camporganizer/module/camplist/CamplistGateway.java @@ -93,7 +93,7 @@ public class CamplistGateway { .leftJoin(V_CAMP).on(V_CAMP.PK.eq(T_PERSON.FK_CAMP)) .where(T_PROFILE.USERNAME.eq(username)) .and(T_PERSON.PK.isNotNull()) - .orderBy(V_CAMP.ARRIVE, T_PERSON.CREATED); + .orderBy(V_CAMP.ARRIVE.desc(), T_PERSON.CREATED); // @formatter:on LOGGER.debug(sql.toString()); List list = new ArrayList<>(); diff --git a/src/main/java/de/jottyfan/camporganizer/module/camplist/CommonController.java b/src/main/java/de/jottyfan/camporganizer/module/camplist/CommonController.java index 5d0c739..9cde09d 100644 --- a/src/main/java/de/jottyfan/camporganizer/module/camplist/CommonController.java +++ b/src/main/java/de/jottyfan/camporganizer/module/camplist/CommonController.java @@ -3,7 +3,8 @@ package de.jottyfan.camporganizer.module.camplist; import javax.servlet.http.HttpServletRequest; import org.keycloak.KeycloakSecurityContext; -import org.springframework.ui.Model; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.ModelAttribute; /** * @@ -12,6 +13,9 @@ import org.springframework.ui.Model; */ public abstract class CommonController { + @Autowired + private HttpServletRequest request; + /** * try to get current keycloak user * @@ -36,15 +40,9 @@ public abstract class CommonController { return ksc == null ? null : ksc.getIdToken().getEmail(); } - /** - * setup the session for the template - * - * @param model the model - * @param request the request - */ - public void setupSession(Model model, HttpServletRequest request) { - String username = getCurrentUser(request); - model.addAttribute("currentUser", username); + @ModelAttribute("currentUser") + public String getCurrentUser() { + return getCurrentUser(request); } /** diff --git a/src/main/java/de/jottyfan/camporganizer/module/confirmation/confirmation/ConfirmationController.java b/src/main/java/de/jottyfan/camporganizer/module/confirmation/confirmation/ConfirmationController.java index 91d4cd4..c5f2f6a 100644 --- a/src/main/java/de/jottyfan/camporganizer/module/confirmation/confirmation/ConfirmationController.java +++ b/src/main/java/de/jottyfan/camporganizer/module/confirmation/confirmation/ConfirmationController.java @@ -10,6 +10,7 @@ import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; +import de.jottyfan.camporganizer.module.camplist.CommonController; import de.jottyfan.camporganizer.module.confirmation.confirmation.impl.CampOverviewBean; /** @@ -18,7 +19,7 @@ import de.jottyfan.camporganizer.module.confirmation.confirmation.impl.CampOverv * */ @Controller -public class ConfirmationController { +public class ConfirmationController extends CommonController { @Autowired private HttpServletRequest request; @@ -28,7 +29,6 @@ public class ConfirmationController { @GetMapping("/confirmation") public String getIndex(Model model) { - String username = indexService.getCurrentUser(request); List campoverview = indexService.getCampOverview(request); CampOverviewBean campoverviewsummary = new CampOverviewBean(LocalDate.now(), "summary"); for (CampOverviewBean bean : campoverview) { @@ -36,7 +36,6 @@ public class ConfirmationController { campoverviewsummary.setRejected(bean.getRejected() + campoverviewsummary.getRejected()); campoverviewsummary.setUntouched(bean.getUntouched() + campoverviewsummary.getUntouched()); } - model.addAttribute("currentUser", username); model.addAttribute("campoverview", campoverview); model.addAttribute("campoverviewsummary", campoverviewsummary); model.addAttribute("untouched", indexService.getUntouched(request)); diff --git a/src/main/java/de/jottyfan/camporganizer/module/confirmation/person/PersonController.java b/src/main/java/de/jottyfan/camporganizer/module/confirmation/person/PersonController.java index 47a5597..8b288fb 100644 --- a/src/main/java/de/jottyfan/camporganizer/module/confirmation/person/PersonController.java +++ b/src/main/java/de/jottyfan/camporganizer/module/confirmation/person/PersonController.java @@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; +import de.jottyfan.camporganizer.module.camplist.CommonController; import de.jottyfan.camporganizer.module.confirmation.confirmation.IConfirmationService; import de.jottyfan.camporganizer.module.confirmation.person.impl.PersonBean; @@ -19,7 +20,7 @@ import de.jottyfan.camporganizer.module.confirmation.person.impl.PersonBean; * */ @Controller -public class PersonController { +public class PersonController extends CommonController { @Autowired private HttpServletRequest request; diff --git a/src/main/java/de/jottyfan/camporganizer/module/document/DocumentController.java b/src/main/java/de/jottyfan/camporganizer/module/document/DocumentController.java index 6036b92..2e53068 100644 --- a/src/main/java/de/jottyfan/camporganizer/module/document/DocumentController.java +++ b/src/main/java/de/jottyfan/camporganizer/module/document/DocumentController.java @@ -15,13 +15,15 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; +import de.jottyfan.camporganizer.module.camplist.CommonController; + /** * * @author jotty * */ @RestController -public class DocumentController { +public class DocumentController extends CommonController { @Autowired private DocumentService service; diff --git a/src/main/java/de/jottyfan/camporganizer/module/ical/ICalController.java b/src/main/java/de/jottyfan/camporganizer/module/ical/ICalController.java index 8db418f..22337d0 100644 --- a/src/main/java/de/jottyfan/camporganizer/module/ical/ICalController.java +++ b/src/main/java/de/jottyfan/camporganizer/module/ical/ICalController.java @@ -8,13 +8,15 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; +import de.jottyfan.camporganizer.module.camplist.CommonController; + /** * * @author jotty * */ @Controller -public class ICalController { +public class ICalController extends CommonController { @Autowired private IICalService service; diff --git a/src/main/java/de/jottyfan/camporganizer/module/migration/MigrationController.java b/src/main/java/de/jottyfan/camporganizer/module/migration/MigrationController.java index 73b226b..722bb3f 100644 --- a/src/main/java/de/jottyfan/camporganizer/module/migration/MigrationController.java +++ b/src/main/java/de/jottyfan/camporganizer/module/migration/MigrationController.java @@ -11,13 +11,15 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; +import de.jottyfan.camporganizer.module.camplist.CommonController; + /** * * @author jotty * */ @Controller -public class MigrationController { +public class MigrationController extends CommonController { @Autowired private MigrationService service; diff --git a/src/main/java/de/jottyfan/camporganizer/module/registration/RegistrationController.java b/src/main/java/de/jottyfan/camporganizer/module/registration/RegistrationController.java index 553b12b..d7c7f2b 100644 --- a/src/main/java/de/jottyfan/camporganizer/module/registration/RegistrationController.java +++ b/src/main/java/de/jottyfan/camporganizer/module/registration/RegistrationController.java @@ -1,6 +1,5 @@ package de.jottyfan.camporganizer.module.registration; -import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; @@ -22,15 +21,11 @@ import de.jottyfan.camporganizer.module.camplist.CommonController; @Controller public class RegistrationController extends CommonController { - @Autowired - private HttpServletRequest request; - @Autowired private RegistrationService service; @GetMapping("/registration/{fkCamp}") public String index(@PathVariable(name = "fkCamp", required = true) Integer fkCamp, Model model) { - super.setupSession(model, request); if (service.campIsNotYetOver(fkCamp)) { CampBean campBean = service.getCamp(fkCamp); model.addAttribute("camp", campBean); @@ -45,8 +40,8 @@ public class RegistrationController extends CommonController { } @PostMapping("/registration/register") - public String register(@Valid @ModelAttribute("bean") RegistrationBean bean, final BindingResult bindingResult, Model model) { - super.setupSession(model, request); + public String register(@Valid @ModelAttribute("bean") RegistrationBean bean, final BindingResult bindingResult, + Model model) { if (bindingResult.hasErrors()) { CampBean campBean = service.getCamp(bean.getFkCamp()); model.addAttribute("camp", campBean); @@ -58,21 +53,18 @@ public class RegistrationController extends CommonController { @GetMapping("/registration/cancel/{id}") public String cancellation(@PathVariable Integer id, final Model model) { - super.setupSession(model, request); model.addAttribute("bean", service.getBooking(id)); return "/registration/cancellation"; } @GetMapping("/registration/remove/{id}") public String remove(@PathVariable Integer id, final Model model) { - super.setupSession(model, request); service.removeBooking(id); return "redirect:/dashboard"; } @GetMapping("/registration/toggleconsent/{id}") public String toggleConsent(@PathVariable Integer id, final Model model) { - super.setupSession(model, request); service.toggleConsent(id); return "redirect:/dashboard"; } diff --git a/src/main/java/de/jottyfan/camporganizer/module/rss/RssController.java b/src/main/java/de/jottyfan/camporganizer/module/rss/RssController.java index d62988c..c80908e 100644 --- a/src/main/java/de/jottyfan/camporganizer/module/rss/RssController.java +++ b/src/main/java/de/jottyfan/camporganizer/module/rss/RssController.java @@ -7,13 +7,15 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; +import de.jottyfan.camporganizer.module.camplist.CommonController; + /** * * @author jotty * */ @Controller -public class RssController { +public class RssController extends CommonController { @Autowired private RssService service; diff --git a/src/main/java/de/jottyfan/camporganizer/module/staticpages/AllgemeinesController.java b/src/main/java/de/jottyfan/camporganizer/module/staticpages/AllgemeinesController.java deleted file mode 100644 index ecae052..0000000 --- a/src/main/java/de/jottyfan/camporganizer/module/staticpages/AllgemeinesController.java +++ /dev/null @@ -1,23 +0,0 @@ -package de.jottyfan.camporganizer.module.staticpages; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; - -/** - * - * @author jotty - * - */ -@Controller -public class AllgemeinesController { - - /** - * load the allgemeines page - * - * @return the allgemeines page - */ - @GetMapping("/allgemeines") - public String getAllgemeines() { - return "/allgemeines"; - } -} diff --git a/src/main/java/de/jottyfan/camporganizer/module/staticpages/DatenschutzController.java b/src/main/java/de/jottyfan/camporganizer/module/staticpages/DatenschutzController.java deleted file mode 100644 index 776c4ae..0000000 --- a/src/main/java/de/jottyfan/camporganizer/module/staticpages/DatenschutzController.java +++ /dev/null @@ -1,23 +0,0 @@ -package de.jottyfan.camporganizer.module.staticpages; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; - -/** - * - * @author jotty - * - */ -@Controller -public class DatenschutzController { - - /** - * load the datenschutz page - * - * @return the datenschutz page - */ - @GetMapping("/datenschutz") - public String getDatenschutz() { - return "/datenschutz"; - } -} diff --git a/src/main/java/de/jottyfan/camporganizer/module/staticpages/ImpressumController.java b/src/main/java/de/jottyfan/camporganizer/module/staticpages/ImpressumController.java deleted file mode 100644 index 2d19c8a..0000000 --- a/src/main/java/de/jottyfan/camporganizer/module/staticpages/ImpressumController.java +++ /dev/null @@ -1,23 +0,0 @@ -package de.jottyfan.camporganizer.module.staticpages; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; - -/** - * - * @author jotty - * - */ -@Controller -public class ImpressumController { - - /** - * load the impressum page - * - * @return the impresum page - */ - @GetMapping("/impressum") - public String getImpressum() { - return "/impressum"; - } -} diff --git a/src/main/java/de/jottyfan/camporganizer/module/staticpages/IndexController.java b/src/main/java/de/jottyfan/camporganizer/module/staticpages/IndexController.java deleted file mode 100644 index 9ed055a..0000000 --- a/src/main/java/de/jottyfan/camporganizer/module/staticpages/IndexController.java +++ /dev/null @@ -1,18 +0,0 @@ -package de.jottyfan.camporganizer.module.staticpages; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; - -/** - * - * @author jotty - * - */ -@Controller -public class IndexController { - - @GetMapping("/") - public String getIndex() { - return "/index"; - } -} diff --git a/src/main/java/de/jottyfan/camporganizer/module/staticpages/KontaktController.java b/src/main/java/de/jottyfan/camporganizer/module/staticpages/KontaktController.java deleted file mode 100644 index d6484f5..0000000 --- a/src/main/java/de/jottyfan/camporganizer/module/staticpages/KontaktController.java +++ /dev/null @@ -1,23 +0,0 @@ -package de.jottyfan.camporganizer.module.staticpages; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; - -/** - * - * @author jotty - * - */ -@Controller -public class KontaktController { - - /** - * load the kontakt page - * - * @return the kontakt page - */ - @GetMapping("/kontakt") - public String getKontakt() { - return "/kontakt"; - } -} diff --git a/src/main/java/de/jottyfan/camporganizer/module/staticpages/ReportsController.java b/src/main/java/de/jottyfan/camporganizer/module/staticpages/ReportsController.java deleted file mode 100644 index 0763f31..0000000 --- a/src/main/java/de/jottyfan/camporganizer/module/staticpages/ReportsController.java +++ /dev/null @@ -1,24 +0,0 @@ -package de.jottyfan.camporganizer.module.staticpages; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; - -/** - * - * @author jotty - * - */ -@Controller -public class ReportsController { - - /** - * load the sub page - * - * @return the sub page - */ - @GetMapping("/reports/{subpage}") - public String getSubpage(@PathVariable("subpage") String subpage) { - return "/reports/" + subpage; - } -} diff --git a/src/main/java/de/jottyfan/camporganizer/module/staticpages/StaticPagesController.java b/src/main/java/de/jottyfan/camporganizer/module/staticpages/StaticPagesController.java new file mode 100644 index 0000000..51e32a4 --- /dev/null +++ b/src/main/java/de/jottyfan/camporganizer/module/staticpages/StaticPagesController.java @@ -0,0 +1,87 @@ +package de.jottyfan.camporganizer.module.staticpages; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; + +import de.jottyfan.camporganizer.module.camplist.CommonController; + +/** + * + * @author jotty + * + */ +@Controller +public class StaticPagesController extends CommonController { + + /** + * load the index page + * + * @return the index page + */ + @GetMapping("/") + public String getIndex() { + return "/index"; + } + + /** + * load the sub page + * + * @return the sub page + */ + @GetMapping("/reports/{subpage}") + public String getSubpage(@PathVariable("subpage") String subpage) { + return "/reports/" + subpage; + } + + /** + * load the verein page + * + * @return the verein page + */ + @GetMapping("/verein") + public String getVerein() { + return "/verein"; + } + + /** + * load the kontakt page + * + * @return the kontakt page + */ + @GetMapping("/kontakt") + public String getKontakt() { + return "/kontakt"; + } + + /** + * load the allgemeines page + * + * @return the allgemeines page + */ + @GetMapping("/allgemeines") + public String getAllgemeines() { + return "/allgemeines"; + } + + /** + * load the datenschutz page + * + * @return the datenschutz page + */ + @GetMapping("/datenschutz") + public String getDatenschutz() { + return "/datenschutz"; + } + + /** + * load the impressum page + * + * @return the impresum page + */ + @GetMapping("/impressum") + public String getImpressum() { + return "/impressum"; + } + +} diff --git a/src/main/java/de/jottyfan/camporganizer/module/staticpages/VereinController.java b/src/main/java/de/jottyfan/camporganizer/module/staticpages/VereinController.java deleted file mode 100644 index 070dd3e..0000000 --- a/src/main/java/de/jottyfan/camporganizer/module/staticpages/VereinController.java +++ /dev/null @@ -1,23 +0,0 @@ -package de.jottyfan.camporganizer.module.staticpages; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; - -/** - * - * @author jotty - * - */ -@Controller -public class VereinController { - - /** - * load the verein page - * - * @return the verein page - */ - @GetMapping("/verein") - public String getVerein() { - return "/verein"; - } -} diff --git a/src/main/resources/templates/camplist.html b/src/main/resources/templates/camplist.html index b7cb3f7..7c5366d 100644 --- a/src/main/resources/templates/camplist.html +++ b/src/main/resources/templates/camplist.html @@ -11,49 +11,7 @@ alte Zugangsdaten ins neue System umziehen - -
-
-
-   -
-
-
- - - - - - - - - - - - - - - - - - - -
-
- Biblische Geschichten
Nachtwanderung
Gruppenspiele
Ausflüge
Überraschungen -
-
Ort
-

-
- -
-
+
diff --git a/src/main/resources/templates/dashboard.html b/src/main/resources/templates/dashboard.html index f8a22da..8742e07 100644 --- a/src/main/resources/templates/dashboard.html +++ b/src/main/resources/templates/dashboard.html @@ -16,33 +16,7 @@
-
-
-
- -
-

-
-
-
- -
-
-
- -
-
-
- -
-
- -
-
-
+

@@ -61,9 +35,8 @@
diff --git a/src/main/resources/templates/fragments/camplist.html b/src/main/resources/templates/fragments/camplist.html new file mode 100644 index 0000000..abaa45d --- /dev/null +++ b/src/main/resources/templates/fragments/camplist.html @@ -0,0 +1,50 @@ + + + +
+ +
+
+
+   +
+
+
+ + + + + + + + + + + + + + + + + + + +
+
+ Biblische Geschichten
Nachtwanderung
Gruppenspiele
Ausflüge
Überraschungen +
+
Ort
+

+
+ +
+
+
+ + \ No newline at end of file diff --git a/src/main/resources/templates/migration/login.html b/src/main/resources/templates/migration/login.html index 7510f5e..fae6c8f 100644 --- a/src/main/resources/templates/migration/login.html +++ b/src/main/resources/templates/migration/login.html @@ -8,47 +8,48 @@
-
-
-
-
-
- [[${error}]]
- +
+ +
+
+
+ [[${error}]]
+
+
+ [[${error}]]
+
+
+ [[${error}]]
+
+
+ [[${error}]]
+
+
+ [[${error}]]
+
-
- [[${error}]]
- -
-
- [[${error}]]
- -
-
- [[${error}]]
- -
-
- [[${error}]]
- +
+
+ +
-
-
- -
-
-
- + +
diff --git a/src/main/resources/templates/template.html b/src/main/resources/templates/template.html index 7560a2c..74dcb3a 100644 --- a/src/main/resources/templates/template.html +++ b/src/main/resources/templates/template.html @@ -70,21 +70,6 @@ -
    -