Skip to content
Snippets Groups Projects

Store programme filter in session

All threads resolved!
3 files
+ 48
4
Compare changes
  • Side-by-side
  • Inline

Files

+ 16
1
@@ -139,8 +139,8 @@ public class EditionController {
@GetMapping("/editions")
public String getEditionList(@AuthenticatedPerson Person person,
@PageableDefault(sort = "id", direction = Sort.Direction.DESC) Pageable pageable,
@RequestParam(required = false) List<Long> programs,
Model model) {
var programs = es.getFilter("/editions");
var editions = eApi
.getEditionsPageActiveOrTaughtBy(person.getId(), fromPageable(pageable), programs)
.block();
@@ -153,10 +153,25 @@ public class EditionController {
model.addAttribute("programs", cCache.getAll()
.stream().map(CourseDetailsDTO::getProgram).distinct()
.collect(Collectors.toList()));
model.addAttribute("filter", programs);
return "edition/index";
}
/**
* Submits the programme filters for the editions page.
*
* @param filter The programmes to filter on
* @return The page to load
*/
@PostMapping("/editions/filter")
public String submitFilters(@RequestParam(required = false) List<Long> filter,
RedirectAttributes redirectAttributes) {
es.storeFilter(filter, "/editions");
redirectAttributes.addAttribute("page", 0);
return "redirect:/editions";
}
/**
* Gets the page for teachers to fill out when requesting a new course to be made.
*
Loading