Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor MrListController and list.html #29

Merged
merged 1 commit into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
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;

@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";
}

Expand Down
10 changes: 10 additions & 0 deletions src/main/resources/static/css/list.css
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,16 @@ table {
padding-right: 10px;
}

.warning {
color: yellow;
font-weight: bold;
}

.severe {
color: orangered;
font-weight: bold;
}

.authorBox {
margin-right: 10px;
}
Expand Down
5 changes: 2 additions & 3 deletions src/main/resources/templates/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@
<span th:text="${detailForm.upvotes}">1</span>
</div>
</div>
<span class="at">
created at:[[${#temporals.format(detailForm.createdAt, 'yyyy/MM/dd
HH:mm:ss')}]]
<span class="at" th:classappend="|${detailForm.createdAt.isBefore(oneWeekAgo) ? 'warning' : ''} ${detailForm.createdAt.isBefore(twoWeeksAgo) ? 'severe' : ''}|">
created at:[[${#temporals.format(detailForm.createdAt, 'yyyy/MM/dd HH:mm:ss')}]]
</span>
<span class="at">
updated at:[[${#temporals.format(detailForm.updatedAt, 'yyyy/MM/dd
Expand Down
Loading