Skip to content

Commit a99d929

Browse files
committed
pop_ups work
1 parent dfb95d4 commit a99d929

File tree

7 files changed

+83
-66
lines changed

7 files changed

+83
-66
lines changed

src/main/java/com/csaba79coder/littersnap/config/SecurityConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
2828
.anyRequest().permitAll() // Allow access to all endpoints
2929
.and()
3030
.formLogin()
31-
.loginPage("/login")
31+
.loginPage("/security/login")
3232
.permitAll()
3333
.and()
3434
.logout()

src/main/java/com/csaba79coder/littersnap/view/HomeController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package com.csaba79coder.littersnap.view;
22

33
import org.springframework.stereotype.Controller;
4-
import org.springframework.web.bind.annotation.RequestMapping;
4+
import org.springframework.web.bind.annotation.GetMapping;
55

66
@Controller
77
public class HomeController {
88

9-
@RequestMapping("/")
9+
@GetMapping({"/","","index","index.html"})
1010
public String index() {
1111
return "index";
1212
}

src/main/java/com/csaba79coder/littersnap/view/LitterViewController.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import java.util.UUID;
1515

1616
@Controller
17-
@RequestMapping("/thy/litter")
17+
//@RequestMapping("/thy/litter")
1818
public class LitterViewController {
1919

2020
private final LitterService litterService;
@@ -23,6 +23,16 @@ public LitterViewController(LitterService litterService) {
2323
this.litterService = litterService;
2424
}
2525

26+
// @GetMapping("/test")
27+
@GetMapping("/login")
28+
public String test(Model model) {
29+
// Add necessary data to the model
30+
model.addAttribute("view", "add_litter_form");
31+
32+
return "index";
33+
}
34+
35+
2636
@GetMapping
2737
public String getAllLitters(Model model) {
2838
List<LitterModel> litters = litterService.getAllLitters();

src/main/resources/static/style.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ body{
2323
z-index: 999;
2424
}
2525

26-
.logo-and-slogo-container{
26+
.logo-and-slogan-container{
2727
position: relative;
2828
}
2929

@@ -65,6 +65,10 @@ body{
6565
}
6666

6767

68+
.input-label-logo-welcome-page{
69+
70+
}
71+
6872
/*All media queries*/
6973

7074
/* Media query for smaller viewports */
Lines changed: 38 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html lang="en">
2+
<html lang="en" xmlns:th="http://www.thymeleaf.org">
33
<head>
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@@ -8,6 +8,9 @@
88

99
<!-- Font Awesome CSS -->
1010
<link rel='stylesheet' href='https://use.fontawesome.com/releases/v5.3.1/css/all.css'>
11+
<link rel="preconnect" href="https://fonts.googleapis.com">
12+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
13+
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
1114
<!-- Include jQuery from Google CDN -->
1215
<link rel="stylesheet" th:href="@{/style.css}">
1316
<link th:src="@{/index.js}">
@@ -16,49 +19,40 @@
1619
</head>
1720

1821
<body>
19-
20-
21-
<div class="d-flex justify-content-center">
22-
<div class="add-report-container">
23-
<!-- Modal content -->
24-
<form th:action="@{/thy/litter/create}" method="post" enctype="multipart/form-data">
25-
<div class="form-group">
26-
<label for="firstLine">First Line</label>
27-
<input type="text" class="form-control" id="firstLine" name="firstLine" required>
28-
</div>
29-
<div class="form-group">
30-
<label for="postCode">Post Code</label>
31-
<input type="text" class="form-control" id="postCode" name="postCode" required>
32-
</div>
33-
<div class="form-group">
34-
<label for="city">City</label>
35-
<input type="text" class="form-control" id="city" name="city" required>
36-
</div>
37-
<div class="form-group">
38-
<label for="country">Country</label>
39-
<input type="text" class="form-control" id="country" name="country" required>
40-
</div>
41-
<div class="form-group">
42-
<label for="description">Description</label>
43-
<textarea class="form-control" id="description" name="description" required></textarea>
44-
</div>
45-
<div class="form-group mt-3">
46-
<label for="image">Photo</label>
47-
<input type="file" class="form-control-file" id="image" name="image" accept="image/*"
48-
required>
49-
</div>
50-
51-
<button type="submit" class="btn btn-primary mt-3">Submit</button>
52-
</form>
22+
<div class="d-flex justify-content-center">
23+
<div class="add-report-container">
24+
<!-- Modal content -->
25+
<form th:action="@{/thy/litter/create}" method="post" enctype="multipart/form-data">
26+
<div class="form-group">
27+
<label for="firstLine">First Line</label>
28+
<input type="text" class="form-control" id="firstLine" name="firstLine" required>
29+
</div>
30+
<div class="form-group">
31+
<label for="postCode">Post Code</label>
32+
<input type="text" class="form-control" id="postCode" name="postCode" required>
33+
</div>
34+
<div class="form-group">
35+
<label for="city">City</label>
36+
<input type="text" class="form-control" id="city" name="city" required>
37+
</div>
38+
<div class="form-group">
39+
<label for="country">Country</label>
40+
<input type="text" class="form-control" id="country" name="country" required>
41+
</div>
42+
<div class="form-group">
43+
<label for="description">Description</label>
44+
<textarea class="form-control" id="description" name="description" required></textarea>
45+
</div>
46+
<div class="form-group mt-3">
47+
<label for="image">Photo</label>
48+
<input type="file" class="form-control-file" id="image" name="image" accept="image/*"
49+
required>
50+
</div>
51+
52+
<button type="submit" class="btn btn-primary mt-3">Submit</button>
53+
</form>
54+
</div>
5355
</div>
54-
</div>
55-
5656

57-
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.7/dist/umd/popper.min.js"
58-
integrity="sha384-zYPOMqeu1DAVkHiLqWBUTcbYfZ8osu1Nd6Z89ify25QV9guujx43ITvfi12/QExE"
59-
crossorigin="anonymous"></script>
60-
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.min.js"
61-
integrity="sha384-Y4oOpwW3duJdCWv5ly8SCFYWqFDsfob/3GkgExXKV4idmbt98QcxXYs9UoXAB7BZ"
62-
crossorigin="anonymous"></script>
6357
</body>
64-
</html>
58+
</html>

src/main/resources/templates/index.html

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,31 +25,41 @@
2525
<!-- Button to trigger the modal -->
2626
<div class="row justify-content-end m-3">
2727
<div class="btn-group col-12 col-md-4 col-lg-2 fixed-buttons">
28-
<button class="btn btn-success btn-sm btn-block m-1" data-bs-toggle="modal" data-bs-target="#signInModal">
28+
<a th:href="@{/login}" class="btn btn-success btn-sm btn-block m-1" data-bs-toggle="modal" data-bs-target="#signInModal">
2929
LogIn
30-
</button>
30+
</a>
3131
<button class="btn btn-warning btn-sm btn-block m-1" data-bs-toggle="modal" data-bs-target="#signUpModal">
3232
SignUp
3333
</button>
3434
</div>
3535
</div>
3636

37-
<!-- modal-->
38-
<div id="addReportModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="addReportModalLabel"
39-
aria-hidden="true">
40-
<div class="modal-dialog" role="document">
41-
<div class="modal-content">
42-
<!-- Content of the modal from add-report.html -->
43-
<div th:include="add_litter_form :: modal-content"></div>
37+
<div th:if="${view != null}" class="modal fade" id="signInModal" tabindex="-1" aria-labelledby="signInModalLabel" aria-hidden="true">
38+
<div class="modal-dialog">
39+
<div class="modal-content">
40+
<div class="modal-header">
41+
<h5 class="modal-title" id="signInModalLabel">Login</h5>
42+
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
43+
</div>
44+
<div class="modal-body">
45+
<!-- Dynamic Content Placeholder -->
46+
<div th:replace="${view}"></div>
4447
</div>
4548
</div>
4649
</div>
50+
</div>
51+
52+
<div th:if="${view == null}">
53+
54+
</div>
55+
56+
4757

4858
<!-- Middle Part -->
4959
<div class="row justify-content-center align-items-center min-vh-100">
5060
<div class="col-12 col-md-8 col-lg-6">
5161

52-
<div class="container logo-and-slogo-container">
62+
<div class="container logo-and-slogan-container">
5363
<div class="row ">
5464
<div class="col-7 col-md-7 col-lg-7">
5565
<!-- Content of the first column -->

src/main/resources/templates/welcome.html

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,26 +42,25 @@
4242

4343

4444
<!-- Middle Part -->
45-
<div class="row justify-content-center align-items-center min-vh-100">
45+
<div class="row justify-content-center align-items-end min-vh-100">
4646
<div class="col-12 col-md-8 col-lg-6">
47-
4847
<div class="container logo-and-slogo-container">
49-
<div class="row ">
48+
<div class="row">
5049
<div class="col-7 col-md-7 col-lg-7">
5150
<!-- Content of the first column -->
52-
<span class="input-label-logo">LitterSnap</span>
51+
<span class="input-label-logo-welcome-page">LitterSnap</span>
5352
<br>
5453
<br>
55-
<span class="input-label-slogan">IF YOU CAN SEE IT, YOU CAN FIX IT...</span>
56-
54+
<span class="input-label-slogan-welcome-page">IF YOU CAN SEE IT, YOU CAN FIX IT...</span>
5755
</div>
58-
<div class="col-5 col-md-5 col-lg-5">
56+
<div class="col-5 col-md-5 col-lg-5 d-flex justify-content-end align-items-end">
5957
<img th:src="@{/images/ManAndPhone.png}" alt="Image" class="man-with-the-phone-icon">
6058
</div>
6159
</div>
6260
</div>
6361
</div>
6462
</div>
63+
6564
</div>
6665

6766

0 commit comments

Comments
 (0)