Display Merge Requests <-> Milestone relations

Show the relation between Merge Requests and Mileston in different
places:
- Merge Request page
- Milestone list page
- Milestone details page
This commit is contained in:
Sergio Visinoni 2012-10-26 15:53:45 +02:00
parent a7d0816933
commit e51c37bdbd
5 changed files with 27 additions and 1 deletions

View file

@ -32,6 +32,7 @@ class MilestonesController < ProjectResourceController
def show
@issues = @milestone.issues
@users = @milestone.participants
@merge_requests = @milestone.merge_requests
respond_to do |format|
format.html

View file

@ -3,6 +3,7 @@ class Milestone < ActiveRecord::Base
belongs_to :project
has_many :issues
has_many :merge_requests
validates :title, presence: true
validates :project, presence: true

View file

@ -14,9 +14,13 @@
%strong.author= link_to_merge_request_author(@merge_request)
- if @merge_request.assignee
%cite.cgray and currently assigned to
%cite.cgray , currently assigned to
= image_tag gravatar_icon(@merge_request.assignee_email), width: 16, class: "lil_av"
%strong.author= link_to_merge_request_assignee(@merge_request)
- if @merge_request.milestone
- milestone = @merge_request.milestone
%cite.cgray and attached to milestone
%strong= link_to_gfm truncate(milestone.title, length: 20), project_milestone_path(milestone.project, milestone)
- if @merge_request.closed

View file

@ -4,6 +4,10 @@
%span.btn.small.disabled.grouped= pluralize milestone.issues.count, 'issues'
- if milestone.issues.count > 0
= link_to 'Browse Issues', project_issues_path(milestone.project, milestone_id: milestone.id), class: "btn small grouped"
- if milestone.merge_requests.any?
%span.btn.small.disabled.grouped= pluralize milestone.issues.count, 'Merge Requests'
- if milestone.merge_requests.count > 0
= link_to 'Browse Merge Requests', project_merge_requests_path(milestone.project, milestone_id: milestone.id), class: "btn small grouped"
- if can? current_user, :admin_milestone, milestone.project
= link_to 'Edit', edit_project_milestone_path(milestone.project, milestone), class: "btn small edit-milestone-link grouped"
%h4

View file

@ -60,6 +60,22 @@
= link_to_gfm truncate(issue.title, length: 60), [@project, issue]
%br
.span6
%table.milestone-merge_requests-filter
%thead
%th
%ul.nav.nav-pills
%li.active= link_to('Open Merge Requests', '#')
%li=link_to('All Merge Requests', '#')
- @merge_requests.each do |merge_request|
%tr{data: {closed: merge_request.closed}}
%td
= link_to [@project, merge_request] do
%span.badge.badge-info ##{merge_request.id}
&ndash;
= link_to_gfm truncate(merge_request.title, length: 60), [@project, merge_request]
%br
.span6
%table
%thead