From 2ad500d75880dba673738a6d10b8d2d36e9eb205 Mon Sep 17 00:00:00 2001 From: neviyn Date: Thu, 29 Apr 2021 21:18:45 +0100 Subject: [PATCH] Added uploaded image count to landing page --- .../kotlin/uk/co/neviyn/booru/Controller.kt | 11 +++++-- src/main/resources/templates/fragments.html | 17 +++++++++++ src/main/resources/templates/landing.html | 30 +++++++++++++++++++ 3 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 src/main/resources/templates/fragments.html create mode 100644 src/main/resources/templates/landing.html diff --git a/src/main/kotlin/uk/co/neviyn/booru/Controller.kt b/src/main/kotlin/uk/co/neviyn/booru/Controller.kt index 8e7fbd1..51031e5 100644 --- a/src/main/kotlin/uk/co/neviyn/booru/Controller.kt +++ b/src/main/kotlin/uk/co/neviyn/booru/Controller.kt @@ -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" + } } diff --git a/src/main/resources/templates/fragments.html b/src/main/resources/templates/fragments.html new file mode 100644 index 0000000..e52508e --- /dev/null +++ b/src/main/resources/templates/fragments.html @@ -0,0 +1,17 @@ + + + +
+ + + + + + + +
+ + \ No newline at end of file diff --git a/src/main/resources/templates/landing.html b/src/main/resources/templates/landing.html new file mode 100644 index 0000000..18c5eb7 --- /dev/null +++ b/src/main/resources/templates/landing.html @@ -0,0 +1,30 @@ + + + + + Booru + + +
+
+
+

Booru

+
+
+
+
+

+ Image board. +

+
+
+
+
+

+ Serving images. +

+
+
+
+ + \ No newline at end of file