From d916d40665b819822eedb3e79412d0612515e085 Mon Sep 17 00:00:00 2001 From: t-takahashi Date: Mon, 29 Jan 2024 08:50:35 +0900 Subject: [PATCH] Refactor MrListController and list.html This commit refactors the MrListController and list.html files. It adds two new model attributes in the MrListController and modifies the th:classappend attribute in list.html to apply different CSS classes based on the createdAt date. --- .../tttol/mrls/controller/MrListController.java | 11 +++++++---- src/main/resources/static/css/list.css | 10 ++++++++++ src/main/resources/templates/list.html | 5 ++--- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/main/java/io/github/tttol/mrls/controller/MrListController.java b/src/main/java/io/github/tttol/mrls/controller/MrListController.java index 3964b6a..bdb639e 100644 --- a/src/main/java/io/github/tttol/mrls/controller/MrListController.java +++ b/src/main/java/io/github/tttol/mrls/controller/MrListController.java @@ -1,18 +1,19 @@ package io.github.tttol.mrls.controller; -import io.github.tttol.mrls.service.MergeRequestService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; +import java.time.OffsetDateTime; + import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import io.github.tttol.mrls.service.MergeRequestService; +import lombok.RequiredArgsConstructor; + @Controller @RequestMapping("/list") @RequiredArgsConstructor -@Slf4j public class MrListController { private final MergeRequestService mergeRequestService; @@ -20,6 +21,8 @@ public class MrListController { @GetMapping("/pat") // Project Access Toekn public String pat(final Model model) { model.addAttribute("mrInfoFormList", mergeRequestService.get(StringUtils.EMPTY)); + model.addAttribute("oneWeekAgo", OffsetDateTime.now().minusDays(7)); + model.addAttribute("twoWeeksAgo", OffsetDateTime.now().minusDays(14)); return "list"; } diff --git a/src/main/resources/static/css/list.css b/src/main/resources/static/css/list.css index 2e0e830..e8fcb12 100644 --- a/src/main/resources/static/css/list.css +++ b/src/main/resources/static/css/list.css @@ -123,6 +123,16 @@ table { padding-right: 10px; } +.warning { + color: yellow; + font-weight: bold; +} + +.severe { + color: orangered; + font-weight: bold; +} + .authorBox { margin-right: 10px; } diff --git a/src/main/resources/templates/list.html b/src/main/resources/templates/list.html index f633d0b..66a1fa2 100644 --- a/src/main/resources/templates/list.html +++ b/src/main/resources/templates/list.html @@ -65,9 +65,8 @@ 1 - - created at:[[${#temporals.format(detailForm.createdAt, 'yyyy/MM/dd - HH:mm:ss')}]] + + created at:[[${#temporals.format(detailForm.createdAt, 'yyyy/MM/dd HH:mm:ss')}]] updated at:[[${#temporals.format(detailForm.updatedAt, 'yyyy/MM/dd