(refs #25)Alert if due date passed.

This commit is contained in:
takezoe
2013-07-20 19:34:58 +09:00
parent 0028431dde
commit e4b2ebe2a4
6 changed files with 37 additions and 11 deletions

View File

@@ -317,7 +317,7 @@ trait IssuesControllerBase extends ControllerBase {
searchIssue(owner, repoName, condition, filter, userName, (page - 1) * IssueLimit, IssueLimit), searchIssue(owner, repoName, condition, filter, userName, (page - 1) * IssueLimit, IssueLimit),
page, page,
(getCollaborators(owner, repoName) :+ owner).sorted, (getCollaborators(owner, repoName) :+ owner).sorted,
getMilestones(owner, repoName).filter(_.closedDate.isEmpty), getMilestones(owner, repoName),
getLabels(owner, repoName), getLabels(owner, repoName),
countIssue(owner, repoName, condition.copy(state = "open"), filter, userName), countIssue(owner, repoName, condition.copy(state = "open"), filter, userName),
countIssue(owner, repoName, condition.copy(state = "closed"), filter, userName), countIssue(owner, repoName, condition.copy(state = "closed"), filter, userName),

View File

@@ -82,6 +82,7 @@ object helpers extends AvatarImageProvider with LinkConverter with RequestCache
def assets(implicit context: app.Context): String = def assets(implicit context: app.Context): String =
s"${context.path}/assets" s"${context.path}/assets"
def isPast(date: Date): Boolean = System.currentTimeMillis > date.getTime
/** /**
* Implicit conversion to add mkHtml() to Seq[Html]. * Implicit conversion to add mkHtml() to Seq[Html].

View File

@@ -65,7 +65,7 @@
@helper.html.checkicon(condition.milestoneId == Some(None)) Issues with no milestone @helper.html.checkicon(condition.milestoneId == Some(None)) Issues with no milestone
</a> </a>
</li> </li>
@milestones.map { milestone => @milestones.filter(_.closedDate.isEmpty).map { milestone =>
<li> <li>
<a href="@condition.copy(milestoneId = Some(Some(milestone.milestoneId))).toURL"> <a href="@condition.copy(milestoneId = Some(Some(milestone.milestoneId))).toURL">
@helper.html.checkicon(condition.milestoneId == Some(Some(milestone.milestoneId))) @milestone.title @helper.html.checkicon(condition.milestoneId == Some(Some(milestone.milestoneId))) @milestone.title
@@ -74,12 +74,27 @@
} }
} }
@if(condition.milestoneId.isDefined && condition.milestoneId.get.isDefined){ @if(condition.milestoneId.isDefined && condition.milestoneId.get.isDefined){
<div class="milestone-progress" style="margin-top: 8px;"> @milestones.find(_.milestoneId == condition.milestoneId.get.get).map { milestone =>
@if(closedCount > 0){ <div class="milestone-progress" style="margin-top: 8px;">
<span class="milestone-progress" style="width: @((closedCount.toDouble / (openCount + closedCount).toDouble * 100).toInt)%;"></span> @if(closedCount > 0){
<span class="milestone-progress" style="width: @((closedCount.toDouble / (openCount + closedCount).toDouble * 100).toInt)%;"></span>
}
</div>
<span class="muted small">@openCount open issues</span>
@if(milestone.closedDate.isDefined){
@milestone.closedDate.map { closedDate =>
<span class="small">Closed in @date(closedDate)</span>
}
} else {
@milestone.dueDate.map { dueDate =>
@if(isPast(dueDate)){
<img src="@assets/common/images/alert.png"/><span class="small milestone-alert">Due in @date(dueDate)</span>
} else {
<span class="small">Due in @date(dueDate)</span>
}
}
} }
</div> }
<span class="muted small">@openCount open issues</span>
} }
<hr/> <hr/>
<strong>Labels</strong> <strong>Labels</strong>

View File

@@ -42,9 +42,13 @@
@if(milestone.closedDate.isDefined){ @if(milestone.closedDate.isDefined){
<span class="muted">Closed @datetime(milestone.closedDate.get)</span> <span class="muted">Closed @datetime(milestone.closedDate.get)</span>
} else { } else {
@if(milestone.dueDate.isDefined){ @milestone.dueDate.map { dueDate =>
<span class="muted">Due in @date(milestone.dueDate.get)</span> @if(isPast(dueDate)){
} else { <img src="@assets/common/images/alert.png"/><span class="muted milestone-alert">Due in @date(dueDate)</span>
} else {
<span class="muted">Due in @date(dueDate)</span>
}
}.getOrElse {
<span class="muted">No due date</span> <span class="muted">No due date</span>
} }
} }

View File

@@ -441,10 +441,16 @@ a#clear-filter {
margin-bottom: 10px; margin-bottom: 10px;
} }
span.milestone-alert {
font-weight: bold;
color: #bd2c00;
}
a.milestone-title { a.milestone-title {
font-size: 120%; font-size: 120%;
font-weight: bold; font-weight: bold;
} }
div.milestone-description { div.milestone-description {
border-top: 1px solid #eee; border-top: 1px solid #eee;
color: #666; color: #666;

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 B