Skip to content

Commit

Permalink
Merge pull request #29 from tttol/fix/28
Browse files Browse the repository at this point in the history
Refactor MrListController and list.html
  • Loading branch information
tttol authored Jan 28, 2024
2 parents d49f6c2 + d916d40 commit a8150bf
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
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

0 comments on commit a8150bf

Please sign in to comment.