Skip to content

Commit

Permalink
navbar: Show the number of user open issues
Browse files Browse the repository at this point in the history
See: Yona Github issue #178
  • Loading branch information
doortts committed Mar 16, 2017
1 parent 815fe3f commit 52b787e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
10 changes: 10 additions & 0 deletions app/assets/stylesheets/less/_page.less
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,16 @@
.border-radius(9px);
}

.counter-badge {
display: inline-block;
font-size: 12px;
padding: 0 3px;
text-align: center;
font-family: @fixed-font-family;
.border-radius(3px);
vertical-align: middle;
}

.project-new-posting {
font-size: 12px;
line-height: 14px;
Expand Down
7 changes: 7 additions & 0 deletions app/models/Issue.java
Original file line number Diff line number Diff line change
Expand Up @@ -658,4 +658,11 @@ public static int countByParentIssueIdAndState(Long parentIssueId, State state){
.eq("state", state)
.findRowCount();
}

public static int countOpenIssuesByUser(User user) {
return finder.where()
.eq("assignee.user.id", user.id)
.eq("state", State.OPEN)
.findRowCount();
}
}
9 changes: 8 additions & 1 deletion app/views/common/usermenu.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
}
}

@myOpenIssueCount = @{
val count = Issue.countOpenIssuesByUser(UserApp.currentUser())
if(count > 0) {
Html("<span class=\"counter-badge\">(" + count + ")</span>")
}
}

<div id="mySidenav" class="sidenav">
<div class="span5 right-menu span-hard-wrap">
<div class="row-fluid user-menu-wrap">
Expand Down Expand Up @@ -64,7 +71,7 @@
</li>
<li class="divider hide-in-mobile"></li>
<li class="gnb-usermenu-item">
<a href="@routes.IssueApp.userIssues()" class="user-item-btn loggged-in">@Messages("issue.myIssue")</a>
<a href="@routes.IssueApp.userIssues()" class="user-item-btn loggged-in">@Messages("issue.myIssue")@myOpenIssueCount</a>
</li>
<li class="divider"></li>
@if(UserApp.currentUser.isSiteManager) {
Expand Down

0 comments on commit 52b787e

Please sign in to comment.