Add labels tab to milestone detail view.
This commit is contained in:
		
							parent
							
								
									c4c919e59d
								
							
						
					
					
						commit
						365d96ca85
					
				|  | @ -19,3 +19,7 @@ | |||
| .color-label { | ||||
|   padding: 3px 4px; | ||||
| } | ||||
| 
 | ||||
| #tab-labels .issues-count { | ||||
|   margin-left: 30px; | ||||
| } | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -85,6 +85,10 @@ class Label < ActiveRecord::Base | |||
|     issues.opened.count | ||||
|   end | ||||
| 
 | ||||
|   def closed_issues_count | ||||
|     issues.closed.count | ||||
|   end | ||||
| 
 | ||||
|   def template? | ||||
|     template | ||||
|   end | ||||
|  |  | |||
|  | @ -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 | ||||
| 
 | ||||
|  |  | |||
|  | @ -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' | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue