~jan0sch/smederee

Showing details for patch e0f5e9ed1e5dee7f3468698daf426748cc269159.
2023-09-12 (Tue), 10:23 AM - Jens Grassel - e0f5e9ed1e5dee7f3468698daf426748cc269159

Tickets: Show tickets on milestone detail page.

- add link to milestone detail page from milestone list
- load milestone tickets and render them on the milestone detail page
Summary of changes
3 files modified with 34 lines added and 2 lines removed
  • modules/hub/src/main/scala/de/smederee/tickets/MilestoneRoutes.scala with 2 added and 1 removed lines
  • modules/hub/src/main/twirl/de/smederee/tickets/views/editMilestones.scala.html with 1 added and 1 removed lines
  • modules/hub/src/main/twirl/de/smederee/tickets/views/showMilestone.scala.html with 31 added and 0 removed lines
diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/tickets/MilestoneRoutes.scala new-smederee/modules/hub/src/main/scala/de/smederee/tickets/MilestoneRoutes.scala
--- old-smederee/modules/hub/src/main/scala/de/smederee/tickets/MilestoneRoutes.scala	2025-01-15 09:41:01.025378036 +0000
+++ new-smederee/modules/hub/src/main/scala/de/smederee/tickets/MilestoneRoutes.scala	2025-01-15 09:41:01.025378036 +0000
@@ -86,6 +86,7 @@
       resp <- (projectAndId, milestone) match {
         case (Some(project, _), Some(milestone)) =>
           for {
+            tickets <- milestone.id.traverse(milestoneId => milestoneRepo.allTickets(None)(milestoneId).compile.toList)
             projectBaseUri <- Sync[F].delay(
               linkConfig.createFullUri(
                 Uri(path =
@@ -105,7 +106,7 @@
                 milestone,
                 renderedDescription,
                 projectBaseUri,
-                Nil,
+                tickets.getOrElse(Nil),
                 s"Milestone ${milestone.title}".some,
                 user,
                 project
diff -rN -u old-smederee/modules/hub/src/main/twirl/de/smederee/tickets/views/editMilestones.scala.html new-smederee/modules/hub/src/main/twirl/de/smederee/tickets/views/editMilestones.scala.html
--- old-smederee/modules/hub/src/main/twirl/de/smederee/tickets/views/editMilestones.scala.html	2025-01-15 09:41:01.025378036 +0000
+++ new-smederee/modules/hub/src/main/twirl/de/smederee/tickets/views/editMilestones.scala.html	2025-01-15 09:41:01.025378036 +0000
@@ -99,7 +99,7 @@
                   <div class="pure-u-1-24 milestone-icon">
                     @icon(baseUri)("flag", lineHeight.some)
                   </div>
-                  <div class="pure-u-5-24 milestone-title" style="height: @{lineHeight}px; line-height: @{lineHeight}px;">@milestone.title @for(dueDate <- milestone.dueDate) { @formatDate(dueDate) }</div>
+                  <div class="pure-u-5-24 milestone-title" style="height: @{lineHeight}px; line-height: @{lineHeight}px;"><a href="@projectBaseUri.addSegment("milestones").addSegment(milestone.title.toString)">@milestone.title @for(dueDate <- milestone.dueDate) { @formatDate(dueDate) }</a></div>
                   <div class="pure-u-8-24 milestone-description" style="height: @{lineHeight}px; line-height: @{lineHeight}px;">
                   @for(description <- milestone.description) {
                     @if(description.toString.length < 180) { @description } else { @description.toString.take(176)) ...}
diff -rN -u old-smederee/modules/hub/src/main/twirl/de/smederee/tickets/views/showMilestone.scala.html new-smederee/modules/hub/src/main/twirl/de/smederee/tickets/views/showMilestone.scala.html
--- old-smederee/modules/hub/src/main/twirl/de/smederee/tickets/views/showMilestone.scala.html	2025-01-15 09:41:01.025378036 +0000
+++ new-smederee/modules/hub/src/main/twirl/de/smederee/tickets/views/showMilestone.scala.html	2025-01-15 09:41:01.025378036 +0000
@@ -58,6 +58,37 @@
   <div class="pure-g">
     <div class="pure-u-1-1 pure-u-md-1-1">
       <div class="l-box">
+        <div class="ticket-list">
+          <h4>@Messages("project.tickets.list.title", tickets.size)</h4>
+          @if(tickets.size === 0) {
+            <div class="alert alert-info">@Messages("project.tickets.list.empty")</div>
+          } else {
+            @for(ticket <- tickets) {
+              <div class="pure-g @if(ticket.status === TicketStatus.Resolved){ticket-resolved}else{ticket}">
+                <div class="pure-u-1-24"><div class="ticket-number">@ticket.number</div></div>
+                <div class="pure-u-20-24"><a class="ticket-title" href="@projectBaseUri.addSegment("tickets").addSegment(ticket.number.toString)">@ticket.title</a></div>
+                <div class="pure-u-3-24"></div>
+              </div>
+              <div class="pure-g ticket-content">
+                <div class="pure-u-1-24"></div>
+                <div class="pure-u-20-24">
+                @for(content <- ticket.content) {
+                  @if(content.toString.length < 180) { @content } else { @content.toString.take(176)) ...}
+                }
+                </div>
+                <div class="pure-u-3-24"></div>
+              </div>
+              <div class="pure-g ticket-details" style="font-size: 14px;">
+                <div class="pure-u-1-24"></div>
+                <div class="pure-u-8-24"></div>
+                <div class="pure-u-3-24">@ticket.status</div>
+                <div class="pure-u-3-24">@ticket.resolution</div>
+                <div class="pure-u-3-24">@for(submitter <- ticket.submitter){<a href="@{linkToHubService.addSegment(s"~${submitter.name}")}">@submitter.name</a>}</div>
+                <div class="pure-u-6-24">@formatDateTime(ticket.updatedAt)</div>
+              </div>
+            }
+          }
+        </div>
       </div>
     </div>
   </div>