diff options
-rw-r--r-- | app/assets/stylesheets/pages/labels.scss | 4 | ||||
-rw-r--r-- | app/controllers/projects/milestones_controller.rb | 1 | ||||
-rw-r--r-- | app/models/label.rb | 4 | ||||
-rw-r--r-- | app/models/milestone.rb | 1 | ||||
-rw-r--r-- | app/views/projects/milestones/show.html.haml | 13 |
5 files changed, 23 insertions, 0 deletions
diff --git a/app/assets/stylesheets/pages/labels.scss b/app/assets/stylesheets/pages/labels.scss index d1590e42fcb..0bc72f30cc3 100644 --- a/app/assets/stylesheets/pages/labels.scss +++ b/app/assets/stylesheets/pages/labels.scss @@ -19,3 +19,7 @@ .color-label { padding: 3px 4px; } + +#tab-labels .issues-count { + margin-left: 30px; +} diff --git a/app/controllers/projects/milestones_controller.rb b/app/controllers/projects/milestones_controller.rb index 15506bd677a..a9912764919 100644 --- a/app/controllers/projects/milestones_controller.rb +++ b/app/controllers/projects/milestones_controller.rb @@ -34,6 +34,7 @@ class Projects::MilestonesController < Projects::ApplicationController @issues = @milestone.issues @users = @milestone.participants.uniq @merge_requests = @milestone.merge_requests + @labels = @milestone.labels end def create diff --git a/app/models/label.rb b/app/models/label.rb index 220da10a6ab..f93ce7e1c89 100644 --- a/app/models/label.rb +++ b/app/models/label.rb @@ -85,6 +85,10 @@ class Label < ActiveRecord::Base issues.opened.count end + def closed_issues_count + issues.closed.count + end + def template? template end diff --git a/app/models/milestone.rb b/app/models/milestone.rb index c9a0ad8b9b6..7dba17726c0 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -27,6 +27,7 @@ class Milestone < ActiveRecord::Base belongs_to :project has_many :issues + has_many :labels, through: :issues has_many :merge_requests has_many :participants, through: :issues, source: :assignee diff --git a/app/views/projects/milestones/show.html.haml b/app/views/projects/milestones/show.html.haml index 528a4f9552f..a6108afd8e7 100644 --- a/app/views/projects/milestones/show.html.haml +++ b/app/views/projects/milestones/show.html.haml @@ -70,6 +70,10 @@ = link_to '#tab-participants', 'data-toggle' => 'tab' do Participants %span.badge= @users.count + %li + = link_to '#tab-labels', 'data-toggle' => 'tab' do + Labels + %span.badge= @labels.count .tab-content .tab-pane.active#tab-issues @@ -128,3 +132,12 @@ %strong= truncate(user.name, lenght: 40) %br %small.cgray= user.username + + .tab-pane#tab-labels + %ul.bordered-list.manage-labels-list + - @labels.each do |label| + %li + = render_colored_label(label) + .pull-right + %span.issues-count= pluralize label.open_issues_count, 'open issue' + %span.issues-count= pluralize label.closed_issues_count, 'closed issue' |