Automatic code tidying
This commit is contained in:
parent
50741a8953
commit
9357299fcd
@ -30,7 +30,7 @@ open class User(
|
||||
)
|
||||
var projects: MutableSet<Project> = mutableSetOf(),
|
||||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) var id: Long? = null
|
||||
) {}
|
||||
)
|
||||
|
||||
@Entity
|
||||
class Project(
|
||||
|
@ -3,19 +3,19 @@ package uk.co.neviyn.projectplanner
|
||||
import org.springframework.data.repository.CrudRepository
|
||||
import java.time.Instant
|
||||
|
||||
interface UserRepository : CrudRepository<User, Long>{
|
||||
interface UserRepository : CrudRepository<User, Long> {
|
||||
fun findByUsername(username: String): User?
|
||||
fun findByIdNotIn(ids: List<Long>) : List<User>
|
||||
fun findByIdNotIn(ids: List<Long>): List<User>
|
||||
}
|
||||
|
||||
interface ProjectRepository : CrudRepository<Project, Long>{}
|
||||
interface ProjectRepository : CrudRepository<Project, Long>
|
||||
|
||||
interface EventRepository : CrudRepository<Event, Long>{
|
||||
fun findByStartAfterAndProject(start: Instant, project: Project) : Set<Event>
|
||||
fun findByEndBeforeAndProject(end: Instant, project: Project) : Set<Event>
|
||||
fun findByStartAfterAndEndBeforeAndProjectIs(start: Instant, end: Instant, project: Project) : Set<Event>
|
||||
interface EventRepository : CrudRepository<Event, Long> {
|
||||
fun findByStartAfterAndProject(start: Instant, project: Project): Set<Event>
|
||||
fun findByEndBeforeAndProject(end: Instant, project: Project): Set<Event>
|
||||
fun findByStartAfterAndEndBeforeAndProjectIs(start: Instant, end: Instant, project: Project): Set<Event>
|
||||
}
|
||||
|
||||
interface TagRepository : CrudRepository<Tag, Long>{}
|
||||
interface TagRepository : CrudRepository<Tag, Long>
|
||||
|
||||
interface CommentRepository : CrudRepository<Comment, Long>{}
|
||||
interface CommentRepository : CrudRepository<Comment, Long>
|
@ -64,7 +64,7 @@ class UserDetailsServiceImpl @Autowired constructor(val userRepository: UserRepo
|
||||
|
||||
@Configuration
|
||||
@EnableGlobalMethodSecurity(prePostEnabled = true)
|
||||
class MethodSecurityConfig @Autowired constructor(val userRepository: UserRepository, val customPermissionEvaluator: CustomPermissionEvaluator) : GlobalMethodSecurityConfiguration() {
|
||||
class MethodSecurityConfig @Autowired constructor(val customPermissionEvaluator: CustomPermissionEvaluator) : GlobalMethodSecurityConfiguration() {
|
||||
|
||||
override fun createExpressionHandler(): MethodSecurityExpressionHandler {
|
||||
val expressionHandler = DefaultMethodSecurityExpressionHandler()
|
||||
|
@ -5,33 +5,38 @@
|
||||
<title th:replace="${title}">Base Title</title>
|
||||
|
||||
<!-- Common styles and scripts -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous">
|
||||
<link crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css"
|
||||
integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" rel="stylesheet">
|
||||
<link rel="shortcut icon" th:href="@{/images/favicon.ico}">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/js/bootstrap.bundle.min.js" integrity="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf" crossorigin="anonymous"></script>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.4.0/font/bootstrap-icons.css">
|
||||
<script crossorigin="anonymous"
|
||||
integrity="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf"
|
||||
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.4.0/font/bootstrap-icons.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div th:fragment="navbar">
|
||||
<form id="logoutForm" method="POST" th:action="@{/logout}">
|
||||
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
|
||||
<input name="${_csrf.parameterName}" type="hidden" value="${_csrf.token}"/>
|
||||
</form>
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="/">
|
||||
<i class="bi bi-calendar3 me-1"></i>Project Planner
|
||||
</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<button aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation" class="navbar-toggler"
|
||||
data-bs-target="#navbarNavAltMarkup" data-bs-toggle="collapse" type="button">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
|
||||
<div class="navbar-nav">
|
||||
<a class="nav-link" aria-current="page" href="/projects">Projects</a>
|
||||
<a aria-current="page" class="nav-link" href="/projects">Projects</a>
|
||||
<a class="nav-link" href="/profile">Profile</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="navbar-nav navbar-right">
|
||||
<a class="nav-link" onclick="document.forms['logoutForm'].submit()" style="cursor: pointer"><i class="bi bi-box-arrow-right me-1"></i>Logout</a>
|
||||
<a class="nav-link" onclick="document.forms['logoutForm'].submit()" style="cursor: pointer"><i
|
||||
class="bi bi-box-arrow-right me-1"></i>Logout</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row justify-content-center mt-3">
|
||||
<div class="col text-center">
|
||||
<img th:src="@{/landing_1.jpg}" class="w-25 rounded-3" alt="landing page" src=""/>
|
||||
<img alt="landing page" class="w-25 rounded-3" src="" th:src="@{/landing_1.jpg}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@ -24,8 +24,8 @@
|
||||
</div>
|
||||
<div class="row justify-content-center">
|
||||
<div class="col text-center">
|
||||
<a href="/login" class="btn btn-primary btn-lg" role="button">Login</a>
|
||||
<a href="/register" class="btn btn-secondary btn-lg" role="button">Register</a>
|
||||
<a class="btn btn-primary btn-lg" href="/login" role="button">Login</a>
|
||||
<a class="btn btn-secondary btn-lg" href="/register" role="button">Register</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -19,16 +19,16 @@
|
||||
<div class="form-group mt-3">
|
||||
<span th:text="${message}"></span>
|
||||
<div class="form-floating mb-3">
|
||||
<input type="text" class="form-control form-control-lg" id="username" name="username" autofocus>
|
||||
<input autofocus class="form-control form-control-lg" id="username" name="username" type="text">
|
||||
<label for="username">Username</label>
|
||||
</div>
|
||||
<div class="form-floating mb-3">
|
||||
<input type="password" class="form-control form-control-lg" id="password" name="password">
|
||||
<input class="form-control form-control-lg" id="password" name="password" type="password">
|
||||
<label for="password">Password</label>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<span class="has-error text-danger" th:text="${error}"></span>
|
||||
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
|
||||
<input name="${_csrf.parameterName}" type="hidden" value="${_csrf.token}"/>
|
||||
|
||||
<div>
|
||||
<button class="btn btn-lg btn-primary btn-block" type="submit">Log In</button>
|
||||
|
@ -12,10 +12,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form th:action="@{/profile}" th:object="${userData}" method="post">
|
||||
<form method="post" th:action="@{/profile}" th:object="${userData}">
|
||||
<div class="row justify-content-center mb-3">
|
||||
<div class="col-8">
|
||||
<input type="hidden" th:field="*{id}"/>
|
||||
<input th:field="*{id}" type="hidden"/>
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text">Username</span>
|
||||
<input aria-label="Username" class="form-control" readonly th:field="*{username}" type="text">
|
||||
@ -31,14 +31,14 @@
|
||||
<p>Please enter your existing password to update your profile.</p>
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text">Existing Password</span>
|
||||
<input aria-label="Existing Password" type="password" class="form-control form-control-lg"
|
||||
th:field="*{oldPassword}">
|
||||
<input aria-label="Existing Password" class="form-control form-control-lg" th:field="*{oldPassword}"
|
||||
type="password">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-2 d-grid">
|
||||
<button type="submit" class="btn btn-primary btn-lg">Update</button>
|
||||
<button class="btn btn-primary btn-lg" type="submit">Update</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -7,17 +7,17 @@
|
||||
<link crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/fullcalendar@5.6.0/main.min.css" rel="stylesheet">
|
||||
<script crossorigin="anonymous" src="https://cdn.jsdelivr.net/npm/fullcalendar@5.6.0/main.min.js"></script>
|
||||
<script crossorigin="anonymous" src="https://cdnjs.cloudflare.com/ajax/libs/list.js/2.3.1/list.min.js"></script>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css" crossorigin="anonymous">
|
||||
<script src="https://cdn.jsdelivr.net/npm/flatpickr" crossorigin="anonymous"></script>
|
||||
<link crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css" rel="stylesheet">
|
||||
<script crossorigin="anonymous" src="https://cdn.jsdelivr.net/npm/flatpickr"></script>
|
||||
<script th:inline="javascript">
|
||||
let calendar;
|
||||
let addModal;
|
||||
let editModal;
|
||||
window.onload = function () {
|
||||
flatpickr("#startTimeInput", { enableTime: true})
|
||||
flatpickr("#endTimeInput", { enableTime: true})
|
||||
const startTimeEdit = flatpickr("#startTimeEdit", { enableTime: true})
|
||||
const endTimeEdit = flatpickr("#endTimeEdit", { enableTime: true})
|
||||
flatpickr("#startTimeInput", {enableTime: true})
|
||||
flatpickr("#endTimeInput", {enableTime: true})
|
||||
const startTimeEdit = flatpickr("#startTimeEdit", {enableTime: true})
|
||||
const endTimeEdit = flatpickr("#endTimeEdit", {enableTime: true})
|
||||
addModal = new bootstrap.Modal(document.getElementById('newEventModal'))
|
||||
editModal = new bootstrap.Modal(document.getElementById('editEventModal'))
|
||||
let calendarEl = document.getElementById('calendar')
|
||||
@ -93,7 +93,8 @@
|
||||
};
|
||||
new List('user-list', options);
|
||||
};
|
||||
function addEvent(){
|
||||
|
||||
function addEvent() {
|
||||
let myEvent = {
|
||||
title: document.getElementById('titleInput').value,
|
||||
description: document.getElementById('descriptionInput').value,
|
||||
@ -102,14 +103,15 @@
|
||||
}
|
||||
calendar.addEvent(myEvent)
|
||||
}
|
||||
function editEvent(){
|
||||
|
||||
function editEvent() {
|
||||
let myEvent = calendar.getEventById(document.getElementById('idEdit').value)
|
||||
let title = document.getElementById('titleEdit').value
|
||||
let description = document.getElementById('descriptionEdit').value
|
||||
let start = document.getElementById('startTimeEdit').value
|
||||
let end = document.getElementById('endTimeEdit').value
|
||||
if(myEvent.title !== title) myEvent.setProp('title', title)
|
||||
if(myEvent.description !== description) myEvent.setExtendedProp('description', description)
|
||||
if (myEvent.title !== title) myEvent.setProp('title', title)
|
||||
if (myEvent.description !== description) myEvent.setExtendedProp('description', description)
|
||||
myEvent.setDates(start, end)
|
||||
}
|
||||
</script>
|
||||
@ -184,7 +186,7 @@
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-secondary" data-bs-dismiss="modal" type="button">Close</button>
|
||||
<button class="btn btn-primary" type="button" onclick="addEvent();addModal.hide()">Add Event</button>
|
||||
<button class="btn btn-primary" onclick="addEvent();addModal.hide()" type="button">Add Event</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -217,10 +219,15 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer justify-content-between">
|
||||
<button type="button" class="btn btn-danger" onclick="calendar.getEventById(document.getElementById('idEdit').value).remove();editModal.hide()">Delete Event</button>
|
||||
<button class="btn btn-danger"
|
||||
onclick="calendar.getEventById(document.getElementById('idEdit').value).remove();editModal.hide()"
|
||||
type="button">
|
||||
Delete Event
|
||||
</button>
|
||||
<div>
|
||||
<button class="btn btn-secondary" data-bs-dismiss="modal" type="button">Close</button>
|
||||
<button class="btn btn-primary" type="button" onclick="editEvent();editModal.hide()">Save Changes</button>
|
||||
<button class="btn btn-secondary" data-bs-dismiss="modal" type="button">Close</button>
|
||||
<button class="btn btn-primary" onclick="editEvent();editModal.hide()" type="button">Save Changes
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -240,7 +247,8 @@
|
||||
<input class="search form-control w-100" placeholder="Search" type="search"/>
|
||||
</label>
|
||||
<div class="list list-group">
|
||||
<form class="list-group-item list-group-item-action" method="post" th:action="@{/project/{pid}/adduser(pid=${id})}"
|
||||
<form class="list-group-item list-group-item-action" method="post"
|
||||
th:action="@{/project/{pid}/adduser(pid=${id})}"
|
||||
th:each="member : ${nonMembers}">
|
||||
<input name="uid" th:value="${member.id}" type="hidden"/>
|
||||
<button class="btn btn-block h-100 w-100 username" th:text="${member.username}"
|
||||
|
@ -17,7 +17,8 @@
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-xl-6 col-md-8 col-sm-12">
|
||||
<div class="list-group">
|
||||
<a th:each="project : ${projects}" class="list-group-item list-group-item-action" th:href="@{~/project/{id}(id=${project.id})}"
|
||||
<a class="list-group-item list-group-item-action" th:each="project : ${projects}"
|
||||
th:href="@{~/project/{id}(id=${project.id})}"
|
||||
th:text="${project.title}">Title
|
||||
</a>
|
||||
</div>
|
||||
@ -42,14 +43,15 @@
|
||||
<button aria-label="Close" class="btn-close" data-bs-dismiss="modal" type="button"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="newProjectForm" class="form-floating mb-3" th:action="@{/newproject}" th:object="${newProject}" method="post">
|
||||
<input class="form-control" id="titleInput" type="text" th:field="*{title}" required>
|
||||
<form class="form-floating mb-3" id="newProjectForm" method="post"
|
||||
th:action="@{/newproject}" th:object="${newProject}">
|
||||
<input class="form-control" id="titleInput" required th:field="*{title}" type="text">
|
||||
<label for="titleInput">Project Title</label>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-secondary" data-bs-dismiss="modal" type="button">Close</button>
|
||||
<button class="btn btn-primary" type="submit" form="newProjectForm">Create Project</button>
|
||||
<button class="btn btn-primary" form="newProjectForm" type="submit">Create Project</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -12,29 +12,33 @@
|
||||
</div>
|
||||
<div class="row justify-content-center mt-3">
|
||||
<div class="col-6 text-center">
|
||||
<form th:action="@{/register}" th:object="${user_details}" method="post" class="needs-validation" novalidate>
|
||||
<form class="needs-validation" method="post" novalidate th:action="@{/register}"
|
||||
th:object="${user_details}">
|
||||
<div class="mb-3">
|
||||
<label for="emailInput" class="form-label">Email address</label>
|
||||
<input type="email" class="form-control form-control-lg" id="emailInput" th:field="*{email}" required/>
|
||||
<label class="form-label" for="emailInput">Email address</label>
|
||||
<input class="form-control form-control-lg" id="emailInput" required th:field="*{email}"
|
||||
type="email"/>
|
||||
<div class="invalid-feedback">
|
||||
Please enter an email address.
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="usernameInput" class="form-label">Username</label>
|
||||
<input type="text" class="form-control form-control-lg" id="usernameInput" th:field="*{username}" required/>
|
||||
<label class="form-label" for="usernameInput">Username</label>
|
||||
<input class="form-control form-control-lg" id="usernameInput" required th:field="*{username}"
|
||||
type="text"/>
|
||||
<div class="invalid-feedback">
|
||||
Please enter a username.
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="passwordInput" class="form-label">Password</label>
|
||||
<input type="password" class="form-control form-control-lg" id="passwordInput" th:field="*{password}" required/>
|
||||
<label class="form-label" for="passwordInput">Password</label>
|
||||
<input class="form-control form-control-lg" id="passwordInput" required
|
||||
th:field="*{password}" type="password"/>
|
||||
<div class="invalid-feedback">
|
||||
Please enter a password.
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary btn-lg">Submit</button>
|
||||
<button class="btn btn-primary btn-lg" type="submit">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@ -44,7 +48,7 @@
|
||||
'use strict'
|
||||
|
||||
// Fetch all the forms we want to apply custom Bootstrap validation styles to
|
||||
var forms = document.querySelectorAll('.needs-validation')
|
||||
let forms = document.querySelectorAll('.needs-validation')
|
||||
|
||||
// Loop over them and prevent submission
|
||||
Array.prototype.slice.call(forms)
|
||||
|
Loading…
Reference in New Issue
Block a user