박완순 2014-04-15
Merge branch 'show-numofthreads-pullrequest-list' of laziel/yobi
from pull request 853
@85a36991aef4f119d8ee04f636362b448617fd8e
app/assets/stylesheets/less/_page.less
--- app/assets/stylesheets/less/_page.less
+++ app/assets/stylesheets/less/_page.less
@@ -3322,11 +3322,30 @@
                 i {vertical-align: middle;}
 
                 .size {margin-right:3px;}
+                .total {color:#777;}
 
                 &:hover {
                     color:#3592b5;
                     text-decoration: none;
                 }
+                &.open   {
+                    color:@state-open !important;
+                }
+                &.closed {
+                    color:@state-closed !important;
+                    .total { color:inherit !important; }
+                }
+            }
+
+            .upload-progress {
+                display: inline-block;
+                width: 30px;
+                vertical-align: middle;
+                overflow: hidden;
+                margin-top: 3px;
+                .border-radius(5px);
+
+                .bar { height:100%; }
             }
         }
     }
app/models/PullRequest.java
--- app/models/PullRequest.java
+++ app/models/PullRequest.java
@@ -973,6 +973,24 @@
     }
 
     /**
+     * 주어진 {@code state} 상태인 댓글 스레드 갯수를 반환한다
+     *
+     * @param state
+     * @return
+     */
+    public int countCommentThreadsByState(CommentThread.ThreadState state){
+        Integer count = 0;
+
+        for (CommentThread commentThread : commentThreads) {
+            if(commentThread.state == state){
+                count++;
+            }
+        }
+
+        return count;
+    }
+
+    /**
      * 주어진 {@commitId}의 변경내역을 돌려준다.
      *
      * @param commitId
app/views/git/partial_list.scala.html
--- app/views/git/partial_list.scala.html
+++ app/views/git/partial_list.scala.html
@@ -3,9 +3,6 @@
 @import utils.JodaDateUtil
 @import utils.TemplateHelper._
 
-@branchName(branch:String) = @{
-    branch.replace("refs/heads/", "")
-}
 <ul class="post-list-wrap">
 @if(page.getList.size()> 0){
     @for(req <- page.getList.iterator()) {
@@ -36,12 +33,22 @@
                     <span class="infos-item" title="@JodaDateUtil.getDateString(req.created)">
                         @agoOrDateString(req.created)
                     </span>
-                    @defining(req.commentThreads.size) { count =>
-                        @if(count > 0) {
-                            <a href="@routes.PullRequestApp.pullRequest(req.toProject.owner, req.toProject.name, req.number)#comments" class="infos-item infos-icon-link">
-                                <i class="yobicon-comments"></i>
-                                <span class="size">@count</span>
-                            </a>
+                    @if(!req.commentThreads.isEmpty){
+                        @defining(req.countCommentThreadsByState(CommentThread.ThreadState.OPEN)){ countOpen =>
+                        <i class="yobicon-post2 vmiddle" style="color:#777;"></i>
+                        <div class="infos-item" style="margin-right:3px">
+                            <div class="upload-progress">
+                                <div class="bar orange" style="width: @getPercent(countOpen.toDouble, req.commentThreads.size.toDouble)%;"></div>
+                            </div>
+                        </div>
+                        <a href="@routes.PullRequestApp.pullRequestChanges(req.toProject.owner, req.toProject.name, req.number)" class="infos-item"
+                           data-toggle="tooltip" title="@if(countOpen > 0){@Messages("pullRequest.review.open") / } @Messages("pullRequest.review.total")">
+                            @if(countOpen > 0){
+                                <span>@countOpen</span>
+                                <span class="gray-txt">/</span>
+                            }
+                            <span class="size total">@req.commentThreads.size</span>
+                        </a>
                         }
                     }
                 </div>
conf/messages
--- conf/messages
+++ conf/messages
@@ -574,6 +574,8 @@
 pullRequest.restore.frombranch.message = can be restored.
 pullRequest.reviewed = Reviewed
 pullRequest.review.participants = <strong>{0}</strong> participants
+pullRequest.review.open = Review threads in Open
+pullRequest.review.total = Total Review threads
 pullRequest.select.branch = Select Branch
 pullRequest.sender = Sender
 pullRequest.sent = Sent Code
conf/messages.ko
--- conf/messages.ko
+++ conf/messages.ko
@@ -576,6 +576,8 @@
 pullRequest.restore.frombranch.message = 브랜치를 복구할 수 있습니다.
 pullRequest.reviewed = 리뷰 완료
 pullRequest.review.participants = 참여자 <strong>{0}</strong>명
+pullRequest.review.open = 열려있는 리뷰
+pullRequest.review.total = 전체 리뷰
 pullRequest.select.branch = 브랜치를 선택하세요.
 pullRequest.sender = 보낸 사람
 pullRequest.sent = 보낸 코드
Add a comment
List