Skip to content
This repository has been archived by the owner on Sep 12, 2018. It is now read-only.

Commit

Permalink
PullRequest: improve list
Browse files Browse the repository at this point in the history
- Move review thread icon to before progres bar and number
- Show number of reviewers on list
- Show names of reviewers as tooltip
- Highlight reviewers number if current user included in it
  • Loading branch information
laziel committed Aug 19, 2014
1 parent 696307f commit fcf2333
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 10 deletions.
7 changes: 6 additions & 1 deletion app/assets/stylesheets/less/_page.less
Original file line number Diff line number Diff line change
Expand Up @@ -3529,7 +3529,12 @@ label.issue-item-row {
.bar { height:100%; }
}

&.over { color:#f36c22; }
.infos-icon { color:#777; margin-right:2px; }

&.over {
color:@yobi-primary !important;
.infos-icon { color:@yobi-primary; }
}
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions app/models/PullRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,16 @@ private void addReviewers(StringBuilder builder) {
}
}

public List<String> getReviewerNames(){
List<String> names = new ArrayList<>();

for(User user : reviewers){
names.add(user.name);
}

return names;
}

private void addCommitMessages(List<GitCommit> commits, StringBuilder builder) {
builder.append(String.format("* %s:\n", this.fromBranch));
for(GitCommit gitCommit : commits) {
Expand Down
2 changes: 1 addition & 1 deletion app/views/git/partial_info.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

<div class="pull-right">
@if(project.isUsingReviewerCount && isAllowed(UserApp.currentUser(), pull.asResource(), Operation.ACCEPT)){
<div style="display:inline-block; margin-right:5px;">
<div id="reviewers" style="display:inline-block; margin-right:5px;">
<span style="font-size: 13px; vertical-align: middle; margin: 0 10px;">
@Html(Messages("pullRequest.review.participants", pull.reviewers.size))
</span>
Expand Down
27 changes: 19 additions & 8 deletions app/views/git/partial_list.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

@import utils.JodaDateUtil
@import utils.TemplateHelper._
@import org.apache.commons.lang3.StringUtils

<ul class="post-list-wrap">
@if(page.getList.size()> 0){
Expand Down Expand Up @@ -55,20 +56,30 @@
</span>
@if(!req.commentThreads.isEmpty){
@defining(req.countCommentThreadsByState(CommentThread.ThreadState.CLOSED)){ countClosed =>
<i class="yobicon-post2 vmiddle" style="color:#777;"></i>
<div class="infos-item" style="margin-right:3px">

<div class="infos-item" style="margin-right:20px;">
<i class="infos-icon yobicon-post2 vmiddle"></i>
<div class="upload-progress">
<div class="bar orange" style="width: @getPercent(countClosed.toDouble, req.commentThreads.size.toDouble)%;"></div>
</div>
<a href="@routes.PullRequestApp.pullRequestChanges(req.toProject.owner, req.toProject.name, req.number)"
data-toggle="tooltip" title="@Messages("pullRequest.review.closed") / @Messages("pullRequest.review.total")">
<span>@countClosed</span>
<span class="gray-txt">/</span>
<span class="size total">@req.commentThreads.size</span>
</a>
</div>
<a href="@routes.PullRequestApp.pullRequestChanges(req.toProject.owner, req.toProject.name, req.number)" class="infos-item"
data-toggle="tooltip" title="@Messages("pullRequest.review.closed") / @Messages("pullRequest.review.total")">
<span>@countClosed</span>
<span class="gray-txt">/</span>
<span class="size total">@req.commentThreads.size</span>
</a>
}
}
@if(project.isUsingReviewerCount && !req.reviewers.isEmpty){
<div class="infos-item @if(req.reviewers.contains(UserApp.currentUser)){over}" style="margin-top:-1px;">
<i class="infos-icon yobicon-preview vmiddle"></i>
<a href="@routes.PullRequestApp.pullRequest(req.toProject.owner, req.toProject.name, req.number)#reviewers"
data-toggle="tooltip" data-html="true" data-title="@StringUtils.join(req.getReviewerNames, "<br>")">
<span class="vmiddle">@req.reviewers.size</span>
</a>
</div>
}
</div>
</div>
<div class="span2">
Expand Down

0 comments on commit fcf2333

Please sign in to comment.