Commit e51c37bd authored by Sergio Visinoni's avatar Sergio Visinoni

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
parent a7d08169
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment