fix(project): hide unavailable create action
This commit is contained in:
+3
-1
@@ -30,7 +30,9 @@ public class ProjectController {
|
||||
|
||||
@GetMapping
|
||||
public String list(Principal principal, Model model) {
|
||||
model.addAttribute("projects", pages.listVisible(actorId(principal)));
|
||||
var actor = pages.authenticatedActor(principal.getName());
|
||||
model.addAttribute("projects", pages.listVisible(actor.userId()));
|
||||
model.addAttribute("canCreateProject", "MENTOR".equals(actor.role()));
|
||||
return "projects/list";
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<body>
|
||||
<main>
|
||||
<h1>Projects</h1>
|
||||
<a href="/projects/new">Create Project</a>
|
||||
<a th:if="${canCreateProject}" href="/projects/new">Create Project</a>
|
||||
<p th:if="${#lists.isEmpty(projects)}">No authorized Projects.</p>
|
||||
<table th:unless="${#lists.isEmpty(projects)}">
|
||||
<caption>Authorized Projects</caption>
|
||||
|
||||
Reference in New Issue
Block a user