Skip to content
Snippets Groups Projects

Enable teachers to archive courses

All threads resolved!

Files

@@ -595,6 +595,35 @@ public class EditionController {
return "redirect:/edition/" + editionId;
}
/**
* Gets the archive edition page to confirm that the teacher wants to archive the edition.
*
* @param editionId The id of the edition to archive.
* @return The Thymeleaf template to resolve.
*/
@GetMapping("/edition/{editionId}/archive")
@PreAuthorize("@permissionService.canManageEdition(#editionId)")
public String getArchiveEdition(@PathVariable Long editionId,
Model model) {
EditionDetailsDTO edition = eCache.getRequired(editionId);
model.addAttribute("edition", edition);
return "edition/view/archive";
}
/**
* Archives the edition
*
* @param editionId The id of the edition to archive.
* @return A redirect back to the edition view page.
*/
@PostMapping("/edition/{editionId}/archive")
@PreAuthorize("@permissionService.canManageEdition(#editionId)")
public String archiveEdition(@PathVariable Long editionId) {
eApi.archiveEdition(editionId).block();
return "redirect:/edition/" + editionId;
}
/**
* Gets the edition status page. This page is a status overview for the entire edition.
*
Loading