Show all issues and merge requests that could be considered opened or closed, includes reopened and merged.
This commit is contained in:
parent
d145f09cd6
commit
d3796b84f8
4 changed files with 23 additions and 9 deletions
|
@ -16,8 +16,6 @@ class Groups::MilestonesController < ApplicationController
|
|||
def show
|
||||
project_milestones = Milestone.where(project_id: group.projects)
|
||||
@group_milestone = Milestones::GroupService.new(project_milestones).milestone(title)
|
||||
@issues = @group_milestone.issues
|
||||
@merge_requests = @group_milestone.merge_requests
|
||||
end
|
||||
|
||||
def update
|
||||
|
|
|
@ -66,14 +66,30 @@ class GroupMilestone
|
|||
end
|
||||
|
||||
def issues
|
||||
milestones.map{ |milestone| milestone.issues }.flatten.group_by(&:state)
|
||||
@group_issues ||= milestones.map{ |milestone| milestone.issues }.flatten.group_by(&:state)
|
||||
end
|
||||
|
||||
def merge_requests
|
||||
milestones.map{ |milestone| milestone.merge_requests }.flatten.group_by(&:state)
|
||||
@group_merge_requests ||= milestones.map{ |milestone| milestone.merge_requests }.flatten.group_by(&:state)
|
||||
end
|
||||
|
||||
def participants
|
||||
milestones.map{ |milestone| milestone.participants.uniq }.reject(&:empty?).flatten
|
||||
end
|
||||
|
||||
def opened_issues
|
||||
issues.values_at("opened", "reopened").compact.flatten
|
||||
end
|
||||
|
||||
def closed_issues
|
||||
issues['closed']
|
||||
end
|
||||
|
||||
def opened_merge_requests
|
||||
merge_requests.values_at("opened", "reopened").compact.flatten
|
||||
end
|
||||
|
||||
def closed_merge_requests
|
||||
merge_requests.values_at("closed", "merged", "locked").compact.flatten
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
.panel-heading= title
|
||||
%ul{ class: "well-list merge_requests-sortable-list" }
|
||||
- if merge_requests
|
||||
- merge_requests.sort_by(&:position).each do |merge_request|
|
||||
- merge_requests.each do |merge_request|
|
||||
= render 'merge_request', merge_request: merge_request
|
||||
|
|
|
@ -54,16 +54,16 @@
|
|||
.tab-pane.active#tab-issues
|
||||
.row
|
||||
.col-md-6
|
||||
= render 'issues', title: "Open", issues: @issues["opened"]
|
||||
= render 'issues', title: "Open", issues: @group_milestone.opened_issues
|
||||
.col-md-6
|
||||
= render 'issues', title: "Closed", issues: @issues["closed"]
|
||||
= render 'issues', title: "Closed", issues: @group_milestone.closed_issues
|
||||
|
||||
.tab-pane#tab-merge-requests
|
||||
.row
|
||||
.col-md-6
|
||||
= render 'merge_requests', title: "Open", merge_requests: @merge_requests["opened"]
|
||||
= render 'merge_requests', title: "Open", merge_requests: @group_milestone.opened_merge_requests
|
||||
.col-md-6
|
||||
= render 'merge_requests', title: "Closed", merge_requests: @merge_requests["closed"]
|
||||
= render 'merge_requests', title: "Closed", merge_requests: @group_milestone.closed_merge_requests
|
||||
|
||||
.tab-pane#tab-participants
|
||||
%ul.bordered-list
|
||||
|
|
Loading…
Reference in a new issue