@(state: String, milestones: List[(gitbucket.core.model.Milestone, Int, Int)], repository: gitbucket.core.service.RepositoryService.RepositoryInfo, hasWritePermission: Boolean)(implicit context: gitbucket.core.controller.Context) @import gitbucket.core.view.helpers @gitbucket.core.html.main(s"Milestones - ${repository.owner}/${repository.name}"){ @gitbucket.core.html.menu("milestones", repository){ @if(context.loginAccount.isDefined){
New milestone
}

@milestones.count(_._1.closedDate.isEmpty) Open @milestones.count(_._1.closedDate.isDefined) Closed
@defining(milestones.filter { case (milestone, _, _) => milestone.closedDate.map(_ => state == "closed").getOrElse(state == "open") }){ milestones => @milestones.map { case (milestone, openCount, closedCount) =>
@milestone.title @if(milestone.closedDate.isDefined){ Closed @gitbucket.core.helper.html.datetimeago(milestone.closedDate.get) } else { @milestone.dueDate.map { dueDate => @if(helpers.isPast(dueDate)){ Due by @helpers.date(dueDate) } else { Due by @helpers.date(dueDate) } }.getOrElse { No due date } } @gitbucket.core.issues.milestones.html.progress(openCount + closedCount, closedCount) @if(closedCount == 0){ 0% } else { @((closedCount.toDouble / (openCount + closedCount).toDouble * 100).toInt)% } complete @openCount open @closedCount closed @if(milestone.description.isDefined){ @helpers.markdown( markdown = milestone.description.get, repository = repository, enableWikiLink = false, enableRefsLink = false, enableLineBreaks = true ) }
} @if(milestones.isEmpty){
No milestones to show. @if(hasWritePermission){ Create a new milestone. }
}
}

} }