Added user to every page, preparing for special access rights.

This commit is contained in:
Andrew Lalis 2019-05-14 11:04:28 +02:00 committed by andrewlalis
parent 89c74f4925
commit 1aa6895aec
33 changed files with 277 additions and 134 deletions

105
design/TAA.svg Normal file
View File

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64"
height="64"
viewBox="0 0 64.000001 64.000001"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="TAA.svg"
inkscape:export-filename="/home/andrew/Programming/Projects/Teaching_Assistant_Assistant/src/main/resources/static/images/logo.png"
inkscape:export-xdpi="360"
inkscape:export-ydpi="360">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="11.2"
inkscape:cx="24.365199"
inkscape:cy="32.206088"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
units="px"
inkscape:window-width="1920"
inkscape:window-height="1030"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-988.36216)">
<rect
style="opacity:1;fill:#008000;fill-opacity:1;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect4136"
width="60"
height="60"
x="1"
y="991.36218"
ry="16" />
<flowRoot
xml:space="preserve"
id="flowRoot4138"
style="font-style:normal;font-weight:normal;font-size:20px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
transform="matrix(2.0532963,0,0,2.0532963,-37.008,965.44742)"><flowRegion
id="flowRegion4140"><rect
id="rect4142"
width="18.125"
height="26.249994"
x="27.5"
y="9.8928566" /></flowRegion><flowPara
id="flowPara4144"
style="fill:#ffffff;fill-opacity:1">T</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot4154"
style="font-style:normal;font-weight:normal;font-size:20px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
transform="matrix(1.3900147,0,0,1.3900147,-2.1586653,998.49896)"><flowRegion
id="flowRegion4156"><rect
id="rect4158"
width="18.125"
height="26.249994"
x="27.5"
y="9.8928566" /></flowRegion><flowPara
id="flowPara4160"
style="fill:#ffffff;fill-opacity:1">A</flowPara></flowRoot> <flowRoot
transform="matrix(1.3900147,0,0,1.3900147,-29.448313,998.49896)"
style="font-style:normal;font-weight:normal;font-size:20px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="flowRoot4162"
xml:space="preserve"><flowRegion
id="flowRegion4164"><rect
y="9.8928566"
x="27.5"
height="26.249994"
width="18.125"
id="rect4166" /></flowRegion><flowPara
style="fill:#ffffff;fill-opacity:1"
id="flowPara4168">A</flowPara></flowRoot> </g>
</svg>

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -37,7 +37,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.and() .and()
.authorizeRequests() .authorizeRequests()
.antMatchers("/css/**") .antMatchers("/css/**", "/images/**")
.permitAll() .permitAll()
.and() .and()

View File

@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.PostMapping;
* Controller for the list of courses in the system. * Controller for the list of courses in the system.
*/ */
@Controller @Controller
public class CoursesController { public class CoursesController extends UserPageController {
private CourseRepository courseRepository; private CourseRepository courseRepository;

View File

@ -1,22 +1,14 @@
package nl.andrewlalis.teaching_assistant_assistant.controllers; package nl.andrewlalis.teaching_assistant_assistant.controllers;
import nl.andrewlalis.teaching_assistant_assistant.model.security.UserDetails;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.GetMapping;
@Controller @Controller
public class RootController { public class RootController extends UserPageController {
@RequestMapping( @GetMapping("/")
path = "/", public String index(Model model) {
produces = "text/html"
)
public String index(Authentication authentication, Model model) {
UserDetails userDetails = (UserDetails) authentication.getPrincipal();
model.addAttribute("user", userDetails.getUser());
return "index"; return "index";
} }
} }

View File

@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.GetMapping;
* Controller for operations dealing with the global collection of students, not particular to one course. * Controller for operations dealing with the global collection of students, not particular to one course.
*/ */
@Controller @Controller
public class StudentsController { public class StudentsController extends UserPageController {
private StudentRepository studentRepository; private StudentRepository studentRepository;

View File

@ -17,7 +17,7 @@ import java.util.Optional;
* Controller for the list of teaching assistants in the system. * Controller for the list of teaching assistants in the system.
*/ */
@Controller @Controller
public class TeachingAssistantsController { public class TeachingAssistantsController extends UserPageController {
private TeachingAssistantRepository teachingAssistantRepository; private TeachingAssistantRepository teachingAssistantRepository;
private CourseRepository courseRepository; private CourseRepository courseRepository;

View File

@ -0,0 +1,23 @@
package nl.andrewlalis.teaching_assistant_assistant.controllers;
import nl.andrewlalis.teaching_assistant_assistant.model.security.User;
import nl.andrewlalis.teaching_assistant_assistant.model.security.UserDetails;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.ModelAttribute;
/**
* An abstract controller which simplifies the definition of controllers for pages that require a user to be signed in.
*/
public abstract class UserPageController {
/**
* A shortcut to get the current authenticated user.
* @param auth The spring authentication.
* @return The user that's logged in.
*/
@ModelAttribute("user")
protected User getUser(Authentication auth) {
UserDetails userDetails = (UserDetails) auth.getPrincipal();
return userDetails.getUser();
}
}

View File

@ -1,5 +1,6 @@
package nl.andrewlalis.teaching_assistant_assistant.controllers.courses; package nl.andrewlalis.teaching_assistant_assistant.controllers.courses;
import nl.andrewlalis.teaching_assistant_assistant.controllers.UserPageController;
import nl.andrewlalis.teaching_assistant_assistant.model.Course; import nl.andrewlalis.teaching_assistant_assistant.model.Course;
import nl.andrewlalis.teaching_assistant_assistant.model.repositories.CourseRepository; import nl.andrewlalis.teaching_assistant_assistant.model.repositories.CourseRepository;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -13,7 +14,7 @@ import java.util.Optional;
* Controller for the course entity, that is, one individual course. * Controller for the course entity, that is, one individual course.
*/ */
@Controller @Controller
public class CourseEntity { public class CourseEntity extends UserPageController {
private CourseRepository courseRepository; private CourseRepository courseRepository;

View File

@ -1,5 +1,6 @@
package nl.andrewlalis.teaching_assistant_assistant.controllers.courses; package nl.andrewlalis.teaching_assistant_assistant.controllers.courses;
import nl.andrewlalis.teaching_assistant_assistant.controllers.UserPageController;
import nl.andrewlalis.teaching_assistant_assistant.model.Course; import nl.andrewlalis.teaching_assistant_assistant.model.Course;
import nl.andrewlalis.teaching_assistant_assistant.model.repositories.CourseRepository; import nl.andrewlalis.teaching_assistant_assistant.model.repositories.CourseRepository;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -7,7 +8,7 @@ import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@Controller @Controller
public class CreateCourse { public class CreateCourse extends UserPageController {
private CourseRepository courseRepository; private CourseRepository courseRepository;

View File

@ -1,5 +1,6 @@
package nl.andrewlalis.teaching_assistant_assistant.controllers.courses; package nl.andrewlalis.teaching_assistant_assistant.controllers.courses;
import nl.andrewlalis.teaching_assistant_assistant.controllers.UserPageController;
import nl.andrewlalis.teaching_assistant_assistant.model.Course; import nl.andrewlalis.teaching_assistant_assistant.model.Course;
import nl.andrewlalis.teaching_assistant_assistant.model.repositories.CourseRepository; import nl.andrewlalis.teaching_assistant_assistant.model.repositories.CourseRepository;
import nl.andrewlalis.teaching_assistant_assistant.util.sample_data.CourseGenerator; import nl.andrewlalis.teaching_assistant_assistant.util.sample_data.CourseGenerator;
@ -10,7 +11,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import java.util.List; import java.util.List;
@Controller @Controller
public class Generate { public class Generate extends UserPageController {
private CourseRepository courseRepository; private CourseRepository courseRepository;

View File

@ -1,5 +1,6 @@
package nl.andrewlalis.teaching_assistant_assistant.controllers.courses.entity; package nl.andrewlalis.teaching_assistant_assistant.controllers.courses.entity;
import nl.andrewlalis.teaching_assistant_assistant.controllers.UserPageController;
import nl.andrewlalis.teaching_assistant_assistant.model.Course; import nl.andrewlalis.teaching_assistant_assistant.model.Course;
import nl.andrewlalis.teaching_assistant_assistant.model.people.teams.StudentTeam; import nl.andrewlalis.teaching_assistant_assistant.model.people.teams.StudentTeam;
import nl.andrewlalis.teaching_assistant_assistant.model.repositories.CourseRepository; import nl.andrewlalis.teaching_assistant_assistant.model.repositories.CourseRepository;
@ -22,7 +23,7 @@ import java.util.Optional;
* Controller for importing students from a CSV sheet. * Controller for importing students from a CSV sheet.
*/ */
@Controller @Controller
public class ImportStudents { public class ImportStudents extends UserPageController {
private CourseRepository courseRepository; private CourseRepository courseRepository;

View File

@ -1,5 +1,6 @@
package nl.andrewlalis.teaching_assistant_assistant.controllers.courses.entity.student_teams; package nl.andrewlalis.teaching_assistant_assistant.controllers.courses.entity.student_teams;
import nl.andrewlalis.teaching_assistant_assistant.controllers.UserPageController;
import nl.andrewlalis.teaching_assistant_assistant.model.Course; import nl.andrewlalis.teaching_assistant_assistant.model.Course;
import nl.andrewlalis.teaching_assistant_assistant.model.people.Student; import nl.andrewlalis.teaching_assistant_assistant.model.people.Student;
import nl.andrewlalis.teaching_assistant_assistant.model.people.teams.StudentTeam; import nl.andrewlalis.teaching_assistant_assistant.model.people.teams.StudentTeam;
@ -18,7 +19,7 @@ import java.util.Optional;
* Controller for exporting team information into readable files. * Controller for exporting team information into readable files.
*/ */
@Controller @Controller
public class ExportStudentTeams { public class ExportStudentTeams extends UserPageController {
private CourseRepository courseRepository; private CourseRepository courseRepository;

View File

@ -1,5 +1,6 @@
package nl.andrewlalis.teaching_assistant_assistant.controllers.courses.entity.student_teams; package nl.andrewlalis.teaching_assistant_assistant.controllers.courses.entity.student_teams;
import nl.andrewlalis.teaching_assistant_assistant.controllers.UserPageController;
import nl.andrewlalis.teaching_assistant_assistant.model.Course; import nl.andrewlalis.teaching_assistant_assistant.model.Course;
import nl.andrewlalis.teaching_assistant_assistant.model.people.teams.StudentTeam; import nl.andrewlalis.teaching_assistant_assistant.model.people.teams.StudentTeam;
import nl.andrewlalis.teaching_assistant_assistant.model.repositories.CourseRepository; import nl.andrewlalis.teaching_assistant_assistant.model.repositories.CourseRepository;
@ -15,7 +16,7 @@ import java.io.IOException;
import java.util.Optional; import java.util.Optional;
@Controller @Controller
public class GenerateRepositories { public class GenerateRepositories extends UserPageController {
private CourseRepository courseRepository; private CourseRepository courseRepository;
private StudentTeamRepository studentTeamRepository; private StudentTeamRepository studentTeamRepository;

View File

@ -1,5 +1,6 @@
package nl.andrewlalis.teaching_assistant_assistant.controllers.courses.entity.student_teams; package nl.andrewlalis.teaching_assistant_assistant.controllers.courses.entity.student_teams;
import nl.andrewlalis.teaching_assistant_assistant.controllers.UserPageController;
import nl.andrewlalis.teaching_assistant_assistant.model.Course; import nl.andrewlalis.teaching_assistant_assistant.model.Course;
import nl.andrewlalis.teaching_assistant_assistant.model.people.teams.StudentTeam; import nl.andrewlalis.teaching_assistant_assistant.model.people.teams.StudentTeam;
import nl.andrewlalis.teaching_assistant_assistant.model.repositories.CourseRepository; import nl.andrewlalis.teaching_assistant_assistant.model.repositories.CourseRepository;
@ -20,7 +21,7 @@ import java.util.Optional;
* TODO: Implement this functionality automatically. * TODO: Implement this functionality automatically.
*/ */
@Controller @Controller
public class MergeSingleTeams { public class MergeSingleTeams extends UserPageController {
private Logger logger = LogManager.getLogger(MergeSingleTeams.class); private Logger logger = LogManager.getLogger(MergeSingleTeams.class);

View File

@ -1,5 +1,6 @@
package nl.andrewlalis.teaching_assistant_assistant.controllers.courses.entity.student_teams; package nl.andrewlalis.teaching_assistant_assistant.controllers.courses.entity.student_teams;
import nl.andrewlalis.teaching_assistant_assistant.controllers.UserPageController;
import nl.andrewlalis.teaching_assistant_assistant.model.Course; import nl.andrewlalis.teaching_assistant_assistant.model.Course;
import nl.andrewlalis.teaching_assistant_assistant.model.people.Student; import nl.andrewlalis.teaching_assistant_assistant.model.people.Student;
import nl.andrewlalis.teaching_assistant_assistant.model.people.teams.StudentTeam; import nl.andrewlalis.teaching_assistant_assistant.model.people.teams.StudentTeam;
@ -20,7 +21,7 @@ import java.util.List;
import java.util.Optional; import java.util.Optional;
@Controller @Controller
public class StudentTeamEntity { public class StudentTeamEntity extends UserPageController {
private StudentTeamRepository studentTeamRepository; private StudentTeamRepository studentTeamRepository;
private CourseRepository courseRepository; private CourseRepository courseRepository;

View File

@ -1,5 +1,6 @@
package nl.andrewlalis.teaching_assistant_assistant.controllers.courses.entity.student_teams; package nl.andrewlalis.teaching_assistant_assistant.controllers.courses.entity.student_teams;
import nl.andrewlalis.teaching_assistant_assistant.controllers.UserPageController;
import nl.andrewlalis.teaching_assistant_assistant.model.Course; import nl.andrewlalis.teaching_assistant_assistant.model.Course;
import nl.andrewlalis.teaching_assistant_assistant.model.people.teams.StudentTeam; import nl.andrewlalis.teaching_assistant_assistant.model.people.teams.StudentTeam;
import nl.andrewlalis.teaching_assistant_assistant.model.repositories.CourseRepository; import nl.andrewlalis.teaching_assistant_assistant.model.repositories.CourseRepository;
@ -15,7 +16,7 @@ import java.util.Optional;
* Updates branch protection for all student repositories in a given course. * Updates branch protection for all student repositories in a given course.
*/ */
@Controller @Controller
public class UpdateBranchProtection { public class UpdateBranchProtection extends UserPageController {
private CourseRepository courseRepository; private CourseRepository courseRepository;

View File

@ -1,5 +1,6 @@
package nl.andrewlalis.teaching_assistant_assistant.controllers.courses.entity.students; package nl.andrewlalis.teaching_assistant_assistant.controllers.courses.entity.students;
import nl.andrewlalis.teaching_assistant_assistant.controllers.UserPageController;
import nl.andrewlalis.teaching_assistant_assistant.model.Course; import nl.andrewlalis.teaching_assistant_assistant.model.Course;
import nl.andrewlalis.teaching_assistant_assistant.model.people.Student; import nl.andrewlalis.teaching_assistant_assistant.model.people.Student;
import nl.andrewlalis.teaching_assistant_assistant.model.repositories.CourseRepository; import nl.andrewlalis.teaching_assistant_assistant.model.repositories.CourseRepository;
@ -17,7 +18,7 @@ import java.util.List;
import java.util.Optional; import java.util.Optional;
@Controller @Controller
public class InviteAllToRepository { public class InviteAllToRepository extends UserPageController {
private CourseRepository courseRepository; private CourseRepository courseRepository;

View File

@ -1,5 +1,6 @@
package nl.andrewlalis.teaching_assistant_assistant.controllers.courses.entity.teaching_assistant_teams; package nl.andrewlalis.teaching_assistant_assistant.controllers.courses.entity.teaching_assistant_teams;
import nl.andrewlalis.teaching_assistant_assistant.controllers.UserPageController;
import nl.andrewlalis.teaching_assistant_assistant.model.Course; import nl.andrewlalis.teaching_assistant_assistant.model.Course;
import nl.andrewlalis.teaching_assistant_assistant.model.people.teams.StudentTeam; import nl.andrewlalis.teaching_assistant_assistant.model.people.teams.StudentTeam;
import nl.andrewlalis.teaching_assistant_assistant.model.people.teams.TeachingAssistantTeam; import nl.andrewlalis.teaching_assistant_assistant.model.people.teams.TeachingAssistantTeam;
@ -14,7 +15,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import java.util.*; import java.util.*;
@Controller @Controller
public class AssignToStudentTeams { public class AssignToStudentTeams extends UserPageController {
private CourseRepository courseRepository; private CourseRepository courseRepository;

View File

@ -1,5 +1,6 @@
package nl.andrewlalis.teaching_assistant_assistant.controllers.courses.entity.teaching_assistant_teams; package nl.andrewlalis.teaching_assistant_assistant.controllers.courses.entity.teaching_assistant_teams;
import nl.andrewlalis.teaching_assistant_assistant.controllers.UserPageController;
import nl.andrewlalis.teaching_assistant_assistant.model.Course; import nl.andrewlalis.teaching_assistant_assistant.model.Course;
import nl.andrewlalis.teaching_assistant_assistant.model.people.TeachingAssistant; import nl.andrewlalis.teaching_assistant_assistant.model.people.TeachingAssistant;
import nl.andrewlalis.teaching_assistant_assistant.model.people.teams.TeachingAssistantTeam; import nl.andrewlalis.teaching_assistant_assistant.model.people.teams.TeachingAssistantTeam;
@ -15,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import java.util.Optional; import java.util.Optional;
@Controller @Controller
public class CreateTeachingAssistantTeam { public class CreateTeachingAssistantTeam extends UserPageController {
private CourseRepository courseRepository; private CourseRepository courseRepository;
private TeachingAssistantRepository teachingAssistantRepository; private TeachingAssistantRepository teachingAssistantRepository;

View File

@ -1,5 +1,6 @@
package nl.andrewlalis.teaching_assistant_assistant.controllers.courses.entity.teaching_assistant_teams; package nl.andrewlalis.teaching_assistant_assistant.controllers.courses.entity.teaching_assistant_teams;
import nl.andrewlalis.teaching_assistant_assistant.controllers.UserPageController;
import nl.andrewlalis.teaching_assistant_assistant.model.Course; import nl.andrewlalis.teaching_assistant_assistant.model.Course;
import nl.andrewlalis.teaching_assistant_assistant.model.people.teams.TeachingAssistantTeam; import nl.andrewlalis.teaching_assistant_assistant.model.people.teams.TeachingAssistantTeam;
import nl.andrewlalis.teaching_assistant_assistant.model.repositories.CourseRepository; import nl.andrewlalis.teaching_assistant_assistant.model.repositories.CourseRepository;
@ -12,7 +13,7 @@ import org.springframework.web.bind.annotation.PathVariable;
import java.util.Optional; import java.util.Optional;
@Controller @Controller
public class TeachingAssistantTeamEntity { public class TeachingAssistantTeamEntity extends UserPageController {
private CourseRepository courseRepository; private CourseRepository courseRepository;
private TeachingAssistantTeamRepository teachingAssistantTeamRepository; private TeachingAssistantTeamRepository teachingAssistantTeamRepository;

View File

@ -1,5 +1,6 @@
package nl.andrewlalis.teaching_assistant_assistant.controllers.students; package nl.andrewlalis.teaching_assistant_assistant.controllers.students;
import nl.andrewlalis.teaching_assistant_assistant.controllers.UserPageController;
import nl.andrewlalis.teaching_assistant_assistant.model.Course; import nl.andrewlalis.teaching_assistant_assistant.model.Course;
import nl.andrewlalis.teaching_assistant_assistant.model.people.Student; import nl.andrewlalis.teaching_assistant_assistant.model.people.Student;
import nl.andrewlalis.teaching_assistant_assistant.model.repositories.CourseRepository; import nl.andrewlalis.teaching_assistant_assistant.model.repositories.CourseRepository;
@ -17,7 +18,7 @@ import java.util.Optional;
* Controller for creating a new student. * Controller for creating a new student.
*/ */
@Controller @Controller
public class StudentCreateController { public class StudentCreateController extends UserPageController {
/** /**
* A constant which defines what value is returned if the user says that the newly created student should not be * A constant which defines what value is returned if the user says that the newly created student should not be

View File

@ -1,5 +1,6 @@
package nl.andrewlalis.teaching_assistant_assistant.controllers.students; package nl.andrewlalis.teaching_assistant_assistant.controllers.students;
import nl.andrewlalis.teaching_assistant_assistant.controllers.UserPageController;
import nl.andrewlalis.teaching_assistant_assistant.model.people.Student; import nl.andrewlalis.teaching_assistant_assistant.model.people.Student;
import nl.andrewlalis.teaching_assistant_assistant.model.repositories.StudentRepository; import nl.andrewlalis.teaching_assistant_assistant.model.repositories.StudentRepository;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -13,7 +14,7 @@ import java.util.Optional;
* Controller for a single student entity. * Controller for a single student entity.
*/ */
@Controller @Controller
public class StudentEntityController { public class StudentEntityController extends UserPageController {
private StudentRepository studentRepository; private StudentRepository studentRepository;

View File

@ -1,5 +1,6 @@
package nl.andrewlalis.teaching_assistant_assistant.controllers.teaching_assistants; package nl.andrewlalis.teaching_assistant_assistant.controllers.teaching_assistants;
import nl.andrewlalis.teaching_assistant_assistant.controllers.UserPageController;
import nl.andrewlalis.teaching_assistant_assistant.model.people.TeachingAssistant; import nl.andrewlalis.teaching_assistant_assistant.model.people.TeachingAssistant;
import nl.andrewlalis.teaching_assistant_assistant.model.repositories.TeachingAssistantRepository; import nl.andrewlalis.teaching_assistant_assistant.model.repositories.TeachingAssistantRepository;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -13,7 +14,7 @@ import java.util.Optional;
* Controller for a single teaching assistant entity. * Controller for a single teaching assistant entity.
*/ */
@Controller @Controller
public class TeachingAssistantEntityController { public class TeachingAssistantEntityController extends UserPageController {
private TeachingAssistantRepository teachingAssistantRepository; private TeachingAssistantRepository teachingAssistantRepository;

View File

@ -1,17 +1,9 @@
.footer_bar { body {
background-color: darkslategray; padding-bottom: 110px;
color: whitesmoke;
height: 30px;
padding-top: 20px;
padding-bottom: 20px;
position: fixed;
width: 100%;
bottom: 0;
z-index: -1; /* Make this footer appear above all other things. */
} }
.third { .footer {
width: 33%; background-color: darkslategray;
display: inline-block; color: whitesmoke;
text-align: center; height: 100px;
} }

View File

@ -1,45 +1,13 @@
body { .header {
padding: 0;
margin: 0;
background-color: whitesmoke;
}
.header_bar {
background-color: green; background-color: green;
width: 100%;
color: whitesmoke; color: whitesmoke;
padding-bottom: 20px;
padding-top: 20px;
height: 30px;
} }
.header_title { .header a {
margin-top: auto;
margin-bottom: auto;
width: 25%;
display: inline;
font-size: 30px;
}
.header_link_list {
list-style-type: none;
margin: 0;
padding: 0;
width: 75%;
display: inline;
}
.header_link_list li {
display: inline-block;
}
.header_link_list a {
text-decoration: none; text-decoration: none;
color: inherit; color: inherit;
background-color: darkgreen;
padding: 10px;
} }
.header_link_list a:hover { .header a:hover {
background-color: darkgray; color: lightgray;
} }

View File

@ -2,6 +2,7 @@
body { body {
font-family: sans-serif; font-family: sans-serif;
background-color: white; background-color: white;
padding-bottom: 70px;
} }
.content_container { .content_container {

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

View File

@ -5,19 +5,32 @@
</head> </head>
<body> <body>
<footer th:fragment="footer" class="footer_bar"> <footer th:fragment="footer" class="container-fluid footer fixed-bottom">
<!-- <link rel="stylesheet" href="../../../resources/static/css/footer.css" th:href="@{/css/footer.css}"/>--> <link rel="stylesheet" th:href="@{/css/footer.css}" type="text/css"/>
<!-- <div class="third">-->
<!-- First third of footer-->
<!-- </div>-->
<!-- <div class="third">-->
<!-- Middle of footer-->
<!-- </div>-->
<!-- <div class="third">-->
<!-- Right side of footer.-->
<!-- </div>-->
<div class="row text-center">
<div class="col-sm-12 col-md-4">
<h5>Quick Links</h5>
</div>
<div class="col-sm-12 col-md-4">
<h5>More links</h5>
</div>
<div class="col-sm-12 col-md-4">
<h5>Yet more links</h5>
</div>
</div>
<div class="row">
<div class="col-12 text-center">
Social media icons go here.
</div>
</div>
<div class="row">
<div class="col-12 text-center">
<p class="h6">
&copy; 2019 Andrew Lalis, all rights reserved.
</p>
</div>
</div>
</footer> </footer>
</body> </body>

View File

@ -7,16 +7,36 @@
<body> <body>
<nav th:fragment="header" class="header_bar"> <nav th:fragment="header" class="navbar navbar-expand navbar- header">
<link rel="stylesheet" href="../../../resources/static/css/header.css" th:href="@{/css/header.css}"/> <link rel="stylesheet" th:href="@{/css/header.css}"/>
<h1 class="header_title">Teaching Assistant <em>Assistant</em></h1>
<ul class="header_link_list"> <a class="navbar-brand" href="/">
<li><a href="/" th:href="@{/}">Home</a> <img src="/../resources/static/images/logo.png" th:src="@{/images/logo.png}" class="d-inline-block align-top" alt="" width="30" height="30"/>
<li><a href="/courses" th:href="@{/courses}">Courses</a> Teaching Assistant Assistant
<li><a href="/students" th:href="@{/students}">Students</a></li> </a>
<li><a href="/teaching_assistants" th:href="@{/teaching_assistants}">Teaching Assistants</a></li> <div class="collapse navbar-collapse">
<li><a href="/logout" th:href="@{/logout}">Log Out</a></li> <ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" th:href="@{/}">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" th:href="@{/courses}">Courses</a>
</li>
<li class="nav-item">
<a class="nav-link" th:href="@{/students}">Students</a>
</li>
<li class="nav-item">
<a class="nav-link" th:href="@{/teaching_assistants}">
Teaching Assistants
</a>
</li>
<li class="nav-item">
<a class="nav-link" th:href="@{/logout}">
Log out (Logged in as <span th:text="${user.getPerson().getFullName()}"></span>)
</a>
</li>
</ul> </ul>
</div>
</nav> </nav>
</body> </body>

View File

@ -4,10 +4,14 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title th:replace="${title}">basic_page</title> <title th:replace="${title}">basic_page</title>
<link rel="stylesheet" href="../../../resources/static/css/style.css" th:href="@{/css/style.css}" /> <link rel="stylesheet" href="../../../resources/static/css/style.css" th:href="@{/css/style.css}" />
<link rel="stylesheet" th:href="@{/css/bootstrap.min.css}"/>
<link rel="icon" th:href="@{/images/favicon.ico}"/>
</head> </head>
<body> <body>
<header th:if="${user != null}">
<div th:replace="~{fragments/header :: header}"></div> <div th:replace="~{fragments/header :: header}"></div>
</header>
<div class="content_container"> <div class="content_container">
<div th:replace="${content}"> <div th:replace="${content}">

View File

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en" th:fragment="layout (title, content, sidebar_content)" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title th:replace="${title}">basic_page</title>
<link rel="stylesheet" href="../../../resources/static/css/style.css" th:href="@{/css/style.css}" />
<link rel="stylesheet" th:href="@{/css/bootstrap.min.css}"/>
<link rel="icon" th:href="@{/images/favicon.ico}"/>
</head>
<body>
<header th:replace="~{fragments/header :: header}"></header>
<div class="content_container">
<div th:replace="${content}">
<p>
Basic page content block.
</p>
</div>
</div>
<div class="sidebar_container">
<div th:replace="${sidebar_content}">
<p>
Basic page sidebar block.
</p>
</div>
</div>
<div th:replace="~{fragments/footer :: footer}"></div>
</body>
</html>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="en"> <html xmlns:th="http://www.thymeleaf.org" th:replace="~{layouts/basic_page :: layout (~{::title}, ~{::#content}, ~{::#sidebar})}" lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Login</title> <title>Login</title>
@ -7,7 +7,7 @@
</head> </head>
<body> <body>
<section class="container"> <section id="content" class="container">
<div class="row justify-content-center"> <div class="row justify-content-center">
<h1>Teaching Assistant <em>Assistant</em></h1> <h1>Teaching Assistant <em>Assistant</em></h1>
</div> </div>
@ -47,33 +47,9 @@
</div> </div>
</section> </section>
<section class="fixed-bottom"> <div id="sidebar">
<div class="container-fluid">
<div class="row text-center">
<div class="col-xs-12 col-4">
<h5>Quick Links</h5>
</div> </div>
<div class="col-xs-12 col-4">
<h5>More links</h5>
</div>
<div class="col-xs-12 col-4">
<h5>Yet more links</h5>
</div>
</div>
<div class="row">
<div class="col-12 text-center">
Social media icons go here.
</div>
</div>
<div class="row">
<div class="col-12 text-center">
<p class="h6">
&copy; 2019 Andrew Lalis, all rights reserved.
</p>
</div>
</div>
</div>
</section>
</body> </body>
</html> </html>