こういう数字を出したい。
ということで
出してみた。
--- a/app/views/dashboard/_filter.html.haml
+++ b/app/views/dashboard/_filter.html.haml
@@ -10,12 +10,21 @@
%li{class: ("active" if !params[:status])}
= link_to dashboard_filter_path(entity, status: nil) do
Open
+ %span.count
+ = Issue.opened.count if entity == 'issue'
+ = current_user.cared_merge_requests.opened.count if entity == 'merge_request'
%li{class: ("active" if params[:status] == 'closed')}
= link_to dashboard_filter_path(entity, status: 'closed') do
Closed
+ %span.count
+ = Issue.with_state(:closed).count if entity == 'issue'
+ = current_user.cared_merge_requests.closed.count if entity == 'merge_request'
%li{class: ("active" if params[:status] == 'all')}
= link_to dashboard_filter_path(entity, status: 'all') do
All
+ %span.count
+ = Issue.count if entity == 'issue'
+ = current_user.cared_merge_requests.count if entity == 'merge_request'
app/views/groups/_filter.html.haml
--- a/app/views/groups/_filter.html.haml
+++ b/app/views/groups/_filter.html.haml
@@ -10,12 +10,15 @@
%li{class: ("active" if !params[:status])}
= link_to group_filter_path(entity, status: nil) do
Open
+ %span.count= Issue.opened.count
%li{class: ("active" if params[:status] == 'closed')}
= link_to group_filter_path(entity, status: 'closed') do
Closed
+ %span.count= Issue.with_state(:closed).count
%li{class: ("active" if params[:status] == 'all')}
= link_to group_filter_path(entity, status: 'all') do
All
+ %span.count= Issue.count
%fieldset
%legend Projects:
app/views/issues/_filter.html.haml
--- a/app/views/issues/_filter.html.haml
+++ b/app/views/issues/_filter.html.haml
@@ -4,29 +4,24 @@
%li{class: ("active" if !params[:status] || params[:status].blank?)}
= link_to project_issues_path(@project, status: nil) do
Open
+ %span.count= @project.issues.opened.count
%li{class: ("active" if params[:status] == 'assigned-to-me')}
= link_to project_issues_path(@project, status: 'assigned-to-me') do
Assigned to me
+ %span.count= @project.issues.open_for(current_user).count
%li{class: ("active" if params[:status] == 'created-by-me')}
= link_to project_issues_path(@project, status: 'created-by-me') do
Created by me
+ %span.count= @project.issues.authored(current_user).count
%li{class: ("active" if params[:status] == 'closed')}
= link_to project_issues_path(@project, status: 'closed') do
Closed
+ %span.count= @project.issues.with_state(:closed).count
%li{class: ("active" if params[:status] == 'all')}
= link_to project_issues_path(@project, status: 'all') do
All
+ %span.count= @project.issues.count
app/views/merge_requests/_filter.html.haml
--- a/app/views/merge_requests/_filter.html.haml
+++ b/app/views/merge_requests/_filter.html.haml
@@ -4,17 +4,21 @@
%li{class: ("active" if (params[:f] == 'open' || !params[:f]))}
= link_to project_merge_requests_path(@project, f: 'open', milestone_id: params[:milestone_id]) do
Open
+ %span.count= @project.merge_requests.opened.count
%li{class: ("active" if params[:f] == "closed")}
= link_to project_merge_requests_path(@project, f: "closed", milestone_id: params[:milestone_id]) do
Closed
+ %span.count= @project.merge_requests.closed.count
%li{class: ("active" if params[:f] == 'assigned-to-me')}
= link_to project_merge_requests_path(@project, f: 'assigned-to-me', milestone_id: params[:milestone_id]) do
Assigned To Me
+ %span.count= @project.merge_requests.opened.assigned(current_user).count
%li{class: ("active" if params[:f] == 'all')}
= link_to project_merge_requests_path(@project, f: 'all', milestone_id: params[:milestone_id]) do
All
+ %span.count= @project.merge_requests.count
app/assets/stylesheets/common.scss
--- a/app/assets/stylesheets/common.scss
+++ b/app/assets/stylesheets/common.scss
@@ -418,3 +418,8 @@ img.emoji {
overflow: hidden;
height: 220px;
}
+
+span.count {
+ float: right;
+ font-weight: bold;
+}