diff --git a/src/main/java/be/seeseepuff/pcinv/controllers/WebController.java b/src/main/java/be/seeseepuff/pcinv/controllers/WebController.java index 7c6d0df..caf9de1 100644 --- a/src/main/java/be/seeseepuff/pcinv/controllers/WebController.java +++ b/src/main/java/be/seeseepuff/pcinv/controllers/WebController.java @@ -1,12 +1,19 @@ package be.seeseepuff.pcinv.controllers; +import be.seeseepuff.pcinv.services.AssetService; +import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; +@RequiredArgsConstructor @Controller public class WebController { + private final AssetService assetService; + @GetMapping("/") - public String index() { - return "index"; // This will resolve to src/main/resources/templates/index.html + public String index(Model model) { + model.addAttribute("asset_count", assetService.countAssets()); + return "index"; } } diff --git a/src/main/resources/templates/fragments.html b/src/main/resources/templates/fragments.html new file mode 100644 index 0000000..4ca2c16 --- /dev/null +++ b/src/main/resources/templates/fragments.html @@ -0,0 +1,13 @@ + + + + + PC Inventory + + +

PC Inventory -

+
+
+
+ + diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index a4ee839..f528dd7 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -1,9 +1,5 @@ - - - - PC Inventory - - -

Hello, world!

- - +
+
+

This system holds 5 assets.

+
+