Added uploaded image count to landing page

This commit is contained in:
neviyn 2021-04-29 21:18:45 +01:00
parent 3ba35d33ec
commit 2ad500d758
3 changed files with 56 additions and 2 deletions

View File

@ -15,10 +15,17 @@ import java.io.File
import java.security.MessageDigest
@Controller
class BaseController {
class BaseController
@Autowired constructor(
val imageRepository: ImageRepository
){
@GetMapping("/")
fun landingPage(): String = "landing"
fun landingPage(model: Model): String {
model.addAttribute("count", imageRepository.count())
println("COUNT:${imageRepository.count()}")
return "landing"
}
}

View File

@ -0,0 +1,17 @@
<!DOCTYPE HTML>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<body>
<div th:fragment="header" th:remove="tag">
<meta charset="UTF-8">
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>📅</text></svg>">
<!-- Common styles and scripts -->
<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">
<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">
</div>
</body>
</html>

View File

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta th:replace="fragments :: header"/>
<title>Booru</title>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col">
<h1 class="display-1 text-center">Booru</h1>
</div>
</div>
<div class="row">
<div class="col">
<p class="lead text-center">
Image board.
</p>
</div>
</div>
<div class="row">
<div class="col">
<p class="text-center">
Serving <span th:text="${count}"></span> images.
</p>
</div>
</div>
</div>
</body>
</html>