Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
s7_spruge_k
calendar
Commits
519c0612
Commit
519c0612
authored
Jun 13, 2019
by
Martins Berzins
Browse files
Integrated event display in /calendar page and some minor fixes/improvements
parent
4963f747
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
82 additions
and
10 deletions
+82
-10
pom.xml
pom.xml
+4
-0
src/main/java/com/example/calendar/controller/CalendarController.java
...a/com/example/calendar/controller/CalendarController.java
+10
-2
src/main/resources/templates/calendar.html
src/main/resources/templates/calendar.html
+66
-2
src/main/resources/templates/login.html
src/main/resources/templates/login.html
+0
-2
src/main/resources/templates/registration.html
src/main/resources/templates/registration.html
+2
-4
No files found.
pom.xml
View file @
519c0612
...
@@ -50,6 +50,10 @@
...
@@ -50,6 +50,10 @@
<artifactId>
h2
</artifactId>
<artifactId>
h2
</artifactId>
<scope>
runtime
</scope>
<scope>
runtime
</scope>
</dependency>
</dependency>
<dependency>
<groupId>
com.google.code.gson
</groupId>
<artifactId>
gson
</artifactId>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-security
</artifactId>
<artifactId>
spring-boot-starter-security
</artifactId>
...
...
src/main/java/com/example/calendar/controller/CalendarController.java
View file @
519c0612
...
@@ -19,6 +19,8 @@ import com.example.calendar.models.User;
...
@@ -19,6 +19,8 @@ import com.example.calendar.models.User;
import
com.example.calendar.repo.CalendarRepo
;
import
com.example.calendar.repo.CalendarRepo
;
import
com.example.calendar.repo.EventRepo
;
import
com.example.calendar.repo.EventRepo
;
import
com.example.calendar.repo.UserRepo
;
import
com.example.calendar.repo.UserRepo
;
import
com.google.gson.JsonArray
;
import
com.google.gson.JsonObject
;
@Controller
@Controller
public
class
CalendarController
{
public
class
CalendarController
{
...
@@ -58,14 +60,20 @@ public class CalendarController {
...
@@ -58,14 +60,20 @@ public class CalendarController {
//Get Events By Calendar
//Get Events By Calendar
ArrayList
<
Event
>
allEvents
=
eventRepo
.
findAllByCalendar
(
c1
);
ArrayList
<
Event
>
allEvents
=
eventRepo
.
findAllByCalendar
(
c1
);
JsonArray
eventArray
=
new
JsonArray
();
for
(
int
i
=
0
;
i
<
allEvents
.
size
();
i
++)
{
JsonObject
eventJson
=
new
JsonObject
();
eventJson
.
addProperty
(
"title"
,
allEvents
.
get
(
i
).
getName
());
eventJson
.
addProperty
(
"start"
,
allEvents
.
get
(
i
).
getStartDate
()
+
"T"
+
allEvents
.
get
(
i
).
getStartTime
());
eventArray
.
add
(
eventJson
);
}
models
.
addAttribute
(
"currentTime"
,
LocalTime
.
now
().
toString
());
models
.
addAttribute
(
"currentTime"
,
LocalTime
.
now
().
toString
());
models
.
addAttribute
(
"currentDate"
,
LocalDate
.
now
().
toString
());
models
.
addAttribute
(
"currentDate"
,
LocalDate
.
now
().
toString
());
models
.
addAttribute
(
"currentMonth"
,
LocalDate
.
now
().
getMonth
());
models
.
addAttribute
(
"currentMonth"
,
LocalDate
.
now
().
getMonth
());
models
.
addAttribute
(
"currentDay"
,
LocalDate
.
now
().
getDayOfWeek
());
models
.
addAttribute
(
"currentDay"
,
LocalDate
.
now
().
getDayOfWeek
());
models
.
addAttribute
(
"currentUser"
,
currUser
.
getUsername
());
models
.
addAttribute
(
"currentUser"
,
currUser
.
getUsername
());
models
.
addAttribute
(
"allEvents"
,
allEvents
);
models
.
addAttribute
(
"allEvents"
,
eventArray
);
return
"calendar"
;
return
"calendar"
;
...
...
src/main/resources/templates/calendar.html
View file @
519c0612
<!DOCTYPE html>
<!--
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<html xmlns:th="http://www.thymeleaf.org">
<head>
<head>
<title>Hello Test</title>
<title>Hello Test</title>
...
@@ -19,4 +19,68 @@
...
@@ -19,4 +19,68 @@
</tr>
</tr>
</table>
</table>
</body>
</body>
</html>
</html>
\ No newline at end of file
-->
<!DOCTYPE html>
<html
xmlns:th=
"http://www.thymeleaf.org"
>
<head>
<link
href=
"https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/fullcalendar.min.css"
rel=
"stylesheet"
>
<link
href=
"https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.7/semantic.min.css"
rel=
"stylesheet"
>
</head>
<body>
<style>
.fc-content
{
font-size
:
1.5em
;
}
.fc-event
{
background-color
:
#007bff
;
}
</style>
<br/>
<div
class=
"ui container"
>
<div
class=
"ui grid"
>
<div
class=
"ui sixteen column"
>
<div
id=
"calendar"
></div>
</div>
</div>
</div>
</div>
<input
type=
"hidden"
id=
"yourId"
th:value=
"${allEvents}"
/>
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.7/semantic.min.js"
></script>
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js"
></script>
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"
></script>
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/fullcalendar.min.js"
></script>
<script
th:inline=
"javascript"
>
$
(
document
).
ready
(
function
()
{
var
all
=
JSON
.
parse
(
$
(
"
#yourId
"
).
val
());
console
.
log
(
all
)
$
(
'
#calendar
'
).
fullCalendar
({
header
:
{
left
:
'
prev,next today
'
,
center
:
'
title
'
,
right
:
'
month,basicWeek,basicDay
'
},
navLinks
:
true
,
// can click day/week names to navigate views
editable
:
false
,
eventLimit
:
true
,
// allow "more" link when too many events
events
:
all
});
});
</script>
</body>
</html>
src/main/resources/templates/login.html
View file @
519c0612
...
@@ -9,7 +9,6 @@
...
@@ -9,7 +9,6 @@
<title>
Authentification
</title>
<title>
Authentification
</title>
<link
rel=
"stylesheet"
href=
"https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity=
"sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin=
"anonymous"
>
<link
rel=
"stylesheet"
href=
"https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity=
"sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin=
"anonymous"
>
<link
href=
"/resources/css/common.css"
rel=
"stylesheet"
>
</head>
</head>
<body>
<body>
...
@@ -44,7 +43,6 @@
...
@@ -44,7 +43,6 @@
</div>
</div>
<script
src=
"https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"
></script>
<script
src=
"https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"
></script>
<script
src=
"/resources/js/bootstrap.min.js"
></script>
<script
src=
"https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity=
"sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin=
"anonymous"
></script>
<script
src=
"https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity=
"sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin=
"anonymous"
></script>
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
integrity=
"sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
crossorigin=
"anonymous"
></script>
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
integrity=
"sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
crossorigin=
"anonymous"
></script>
<script
src=
"https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
integrity=
"sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
crossorigin=
"anonymous"
></script>
<script
src=
"https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
integrity=
"sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
crossorigin=
"anonymous"
></script>
...
...
src/main/resources/templates/registration.html
View file @
519c0612
...
@@ -9,7 +9,6 @@
...
@@ -9,7 +9,6 @@
<title>
Create an account
</title>
<title>
Create an account
</title>
<link
rel=
"stylesheet"
href=
"https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity=
"sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin=
"anonymous"
>
<link
rel=
"stylesheet"
href=
"https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity=
"sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin=
"anonymous"
>
<link
href=
"@{/resources/css/common.css}"
rel=
"stylesheet"
>
</head>
</head>
<body>
<body>
...
@@ -25,12 +24,12 @@
...
@@ -25,12 +24,12 @@
</div>
</div>
<div
class=
"form-group"
th:classappend=
"${#fields.hasErrors('*')} ? 'has-error' : ''"
>
<div
class=
"form-group"
th:classappend=
"${#fields.hasErrors('*')} ? 'has-error' : ''"
>
<input
name=
"password"
type=
"
text
"
class=
"form-control"
placeholder=
"Password"
autofocus=
"true"
/><br>
<input
name=
"password"
type=
"
password
"
class=
"form-control"
placeholder=
"Password"
autofocus=
"true"
/><br>
<p
class=
"alert alert-danger"
th:if=
"${#fields.hasErrors('password')}"
th:errors=
"*{password}"
></p>
<p
class=
"alert alert-danger"
th:if=
"${#fields.hasErrors('password')}"
th:errors=
"*{password}"
></p>
</div>
</div>
<div
class=
"form-group"
th:classappend=
"${#fields.hasErrors('*')} ? 'has-error' : ''"
>
<div
class=
"form-group"
th:classappend=
"${#fields.hasErrors('*')} ? 'has-error' : ''"
>
<input
name=
"passwordConfirm"
type=
"
text
"
class=
"form-control"
placeholder=
"Confirm your password"
autofocus=
"true"
/><br>
<input
name=
"passwordConfirm"
type=
"
password
"
class=
"form-control"
placeholder=
"Confirm your password"
autofocus=
"true"
/><br>
<p
class=
"alert alert-danger"
th:if=
"${#fields.hasErrors('passwordConfirm')}"
th:errors=
"*{passwordConfirm}"
></p>
<p
class=
"alert alert-danger"
th:if=
"${#fields.hasErrors('passwordConfirm')}"
th:errors=
"*{passwordConfirm}"
></p>
</div>
</div>
...
@@ -43,7 +42,6 @@
...
@@ -43,7 +42,6 @@
</div>
</div>
<script
src=
"https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"
></script>
<script
src=
"https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"
></script>
<script
src=
"@{/resources/js/bootstrap.min.js}"
></script>
<script
src=
"https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity=
"sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin=
"anonymous"
></script>
<script
src=
"https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity=
"sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin=
"anonymous"
></script>
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
integrity=
"sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
crossorigin=
"anonymous"
></script>
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
integrity=
"sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
crossorigin=
"anonymous"
></script>
<script
src=
"https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
integrity=
"sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
crossorigin=
"anonymous"
></script>
<script
src=
"https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
integrity=
"sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
crossorigin=
"anonymous"
></script>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment