Loading src/main/java/com/example/demo/CustomLoginSuccessHandler.java +1 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ public class CustomLoginSuccessHandler extends SimpleUrlAuthenticationSuccessHan url = "/admin"; } else if (roles.contains("POULAIN") || roles.contains("MENTOR")) { url = "/member"; url = "/"; } return url; } Loading src/main/java/com/example/demo/controller/UserController.java +16 −6 Original line number Diff line number Diff line package com.example.demo.controller; import java.security.Principal; import java.util.List; import javax.servlet.http.HttpSession; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; Loading @@ -13,7 +15,11 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; import com.example.demo.HelpPropositionRepository; import com.example.demo.HelpRequest; import com.example.demo.HelpRequestRepository; import com.example.demo.model.User; import com.example.demo.repository.UserRepository; import com.example.demo.service.UserServiceInterface; @Controller Loading @@ -22,7 +28,14 @@ public class UserController { @Autowired private UserServiceInterface userService; @Autowired HelpPropositionRepository helpPropositionRepository; @Autowired HelpRequestRepository helpRequestRepository; @Autowired UserRepository userRepository; @RequestMapping(value = "/register", method = RequestMethod.GET) public ModelAndView register() { Loading Loading @@ -82,15 +95,12 @@ public class UserController { @RequestMapping(value = "/admin", method = RequestMethod.GET) public ModelAndView adminHome() { ModelAndView modelAndView = new ModelAndView(); modelAndView.addObject("helpRequests", helpRequestRepository.findAll()); modelAndView.addObject("helpPropositions", helpPropositionRepository.findAll()); modelAndView.addObject("users", userRepository.findAll()); modelAndView.setViewName("admin"); // resources/template/admin.html return modelAndView; } @RequestMapping(value = "/member", method = RequestMethod.GET) public ModelAndView memberHome() { ModelAndView modelAndView = new ModelAndView(); modelAndView.setViewName("member"); // resources/template/member.html return modelAndView; } } src/main/resources/templates/ProfileHelpRequest.html +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ <p th:text="${#dates.format(help.dateEnd, 'dd-MM-yyyy HH:mm')}"></p> <p th:text="${help.poulain.id}"></p> <p th:if="${help.mentor != null}" th:text=" ${help.mentor.id}"></p> <button th:unless="${help.mentor != null}">Se proposer</button> <p th:unless="${help.mentor != null}">null</p> </div> </div> </div> Loading src/main/resources/templates/admin.html +71 −1 Original line number Diff line number Diff line Loading @@ -2,12 +2,82 @@ <html> <head> <meta charset="ISO-8859-1"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.0/css/materialize.min.css"> <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.0/js/materialize.min.js"></script> <title>Admin page</title> </head> <body> <header th:insert="nav.html :: header"> </header> <p> This is the admin page. You can access it because you're an admin. </p> <a href="/">Get back to home</a> <h1>All Users</h1> <table class="table"> <thead> <tr> <th scope="col">Id</th> <th scope="col">UserName</th> <th scope="col">Email</th> <th scope="col">Status</th> <th scope="col">Roles</th> </tr> </thead> <tbody> <tr th:each="user: ${users}"> <td th:text="${user.id}" /> <td th:text="${user.username}" /> <td th:text="${user.email}" /> <td th:text="${user.status}"/> <div th:if="${not #sets.isEmpty(user.roles)}"> <td th:each="role :${user.roles}"> <p th:text="${role.name} "/> </td> </div> </tr> </tbody> </table> </div> <h1>All Propositions</h1> <div th:each="help: ${helpPropositions}"> <div class="row"> <div class="col s12 m6"> <div class="card-panel teal lighten-1"> <div class="card-content white-text"> <span class="card-title" th:text="${help.matiere}"></span> <p th:text="${help.comment}"></p> <p th:text="${#dates.format(help.dateBegin, 'dd-MM-yyyy HH:mm')}"></p> <p th:text="${#dates.format(help.dateEnd, 'dd-MM-yyyy HH:mm')}"></p> <p th:text="${help.mentor.id}"></p> <p th:if="${help.poulain != null}" th:text=" ${help.poulain.id}"></p> <p th:unless="${help.poulain != null}">null</p> </div> </div> </div> </div> </div> <h1>All Help Request</h1> <div th:each="help: ${helpRequests}"> <div class="row"> <div class="col s12 m6"> <div class="card-panel teal lighten-1"> <div class="card-content white-text"> <span class="card-title" th:text="${help.matiere}"></span> <p th:text="${help.comment}"></p> <p th:text="${#dates.format(help.dateBegin, 'dd-MM-yyyy HH:mm')}"></p> <p th:text="${#dates.format(help.dateEnd, 'dd-MM-yyyy HH:mm')}"></p> <p th:text="${help.poulain.id}"></p> <p th:if="${help.mentor != null}" th:text=" ${help.mentor.id}"></p> <p th:unless="${help.mentor != null}">null</p> </div> </div> </div> </div> </div> </body> </html> No newline at end of file src/main/resources/templates/member.htmldeleted 100644 → 0 +0 −13 Original line number Diff line number Diff line <!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>Member page</title> </head> <body> <p> This is the member page. You're a "poulain" or a "mentor". </p> <a href="/">Get back to home</a> </body> </html> No newline at end of file src/main/resources/templates/allHelpProposition.html +1 −1 File changed.Contains only whitespace changes. Show changes Loading
src/main/java/com/example/demo/CustomLoginSuccessHandler.java +1 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ public class CustomLoginSuccessHandler extends SimpleUrlAuthenticationSuccessHan url = "/admin"; } else if (roles.contains("POULAIN") || roles.contains("MENTOR")) { url = "/member"; url = "/"; } return url; } Loading
src/main/java/com/example/demo/controller/UserController.java +16 −6 Original line number Diff line number Diff line package com.example.demo.controller; import java.security.Principal; import java.util.List; import javax.servlet.http.HttpSession; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; Loading @@ -13,7 +15,11 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; import com.example.demo.HelpPropositionRepository; import com.example.demo.HelpRequest; import com.example.demo.HelpRequestRepository; import com.example.demo.model.User; import com.example.demo.repository.UserRepository; import com.example.demo.service.UserServiceInterface; @Controller Loading @@ -22,7 +28,14 @@ public class UserController { @Autowired private UserServiceInterface userService; @Autowired HelpPropositionRepository helpPropositionRepository; @Autowired HelpRequestRepository helpRequestRepository; @Autowired UserRepository userRepository; @RequestMapping(value = "/register", method = RequestMethod.GET) public ModelAndView register() { Loading Loading @@ -82,15 +95,12 @@ public class UserController { @RequestMapping(value = "/admin", method = RequestMethod.GET) public ModelAndView adminHome() { ModelAndView modelAndView = new ModelAndView(); modelAndView.addObject("helpRequests", helpRequestRepository.findAll()); modelAndView.addObject("helpPropositions", helpPropositionRepository.findAll()); modelAndView.addObject("users", userRepository.findAll()); modelAndView.setViewName("admin"); // resources/template/admin.html return modelAndView; } @RequestMapping(value = "/member", method = RequestMethod.GET) public ModelAndView memberHome() { ModelAndView modelAndView = new ModelAndView(); modelAndView.setViewName("member"); // resources/template/member.html return modelAndView; } }
src/main/resources/templates/ProfileHelpRequest.html +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ <p th:text="${#dates.format(help.dateEnd, 'dd-MM-yyyy HH:mm')}"></p> <p th:text="${help.poulain.id}"></p> <p th:if="${help.mentor != null}" th:text=" ${help.mentor.id}"></p> <button th:unless="${help.mentor != null}">Se proposer</button> <p th:unless="${help.mentor != null}">null</p> </div> </div> </div> Loading
src/main/resources/templates/admin.html +71 −1 Original line number Diff line number Diff line Loading @@ -2,12 +2,82 @@ <html> <head> <meta charset="ISO-8859-1"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.0/css/materialize.min.css"> <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.0/js/materialize.min.js"></script> <title>Admin page</title> </head> <body> <header th:insert="nav.html :: header"> </header> <p> This is the admin page. You can access it because you're an admin. </p> <a href="/">Get back to home</a> <h1>All Users</h1> <table class="table"> <thead> <tr> <th scope="col">Id</th> <th scope="col">UserName</th> <th scope="col">Email</th> <th scope="col">Status</th> <th scope="col">Roles</th> </tr> </thead> <tbody> <tr th:each="user: ${users}"> <td th:text="${user.id}" /> <td th:text="${user.username}" /> <td th:text="${user.email}" /> <td th:text="${user.status}"/> <div th:if="${not #sets.isEmpty(user.roles)}"> <td th:each="role :${user.roles}"> <p th:text="${role.name} "/> </td> </div> </tr> </tbody> </table> </div> <h1>All Propositions</h1> <div th:each="help: ${helpPropositions}"> <div class="row"> <div class="col s12 m6"> <div class="card-panel teal lighten-1"> <div class="card-content white-text"> <span class="card-title" th:text="${help.matiere}"></span> <p th:text="${help.comment}"></p> <p th:text="${#dates.format(help.dateBegin, 'dd-MM-yyyy HH:mm')}"></p> <p th:text="${#dates.format(help.dateEnd, 'dd-MM-yyyy HH:mm')}"></p> <p th:text="${help.mentor.id}"></p> <p th:if="${help.poulain != null}" th:text=" ${help.poulain.id}"></p> <p th:unless="${help.poulain != null}">null</p> </div> </div> </div> </div> </div> <h1>All Help Request</h1> <div th:each="help: ${helpRequests}"> <div class="row"> <div class="col s12 m6"> <div class="card-panel teal lighten-1"> <div class="card-content white-text"> <span class="card-title" th:text="${help.matiere}"></span> <p th:text="${help.comment}"></p> <p th:text="${#dates.format(help.dateBegin, 'dd-MM-yyyy HH:mm')}"></p> <p th:text="${#dates.format(help.dateEnd, 'dd-MM-yyyy HH:mm')}"></p> <p th:text="${help.poulain.id}"></p> <p th:if="${help.mentor != null}" th:text=" ${help.mentor.id}"></p> <p th:unless="${help.mentor != null}">null</p> </div> </div> </div> </div> </div> </body> </html> No newline at end of file
src/main/resources/templates/member.htmldeleted 100644 → 0 +0 −13 Original line number Diff line number Diff line <!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>Member page</title> </head> <body> <p> This is the member page. You're a "poulain" or a "mentor". </p> <a href="/">Get back to home</a> </body> </html> No newline at end of file
src/main/resources/templates/allHelpProposition.html +1 −1 File changed.Contains only whitespace changes. Show changes