BigW Consortium Gitlab

Commit 4ca8a175 by Marin Jankovski

Filter group milestones.

parent 0723bf1a
......@@ -6,6 +6,16 @@ class Groups::MilestonesController < ApplicationController
project_ids = @group.projects
project_milestones = Milestone.where(project_id: project_ids)
@group_milestones = Milestones::GroupService.new(project_milestones).execute
@group_milestones = case params[:status]
when 'all'; @group_milestones
when 'closed'; status('closed')
else status('active')
end
end
private
def status(state)
@group_milestones.map{ |milestone| next if milestone.state != state; milestone }.compact
end
end
......@@ -35,8 +35,7 @@ module GroupsHelper
def group_filter_path(entity, options={})
exist_opts = {
state: params[:state],
scope: params[:scope]
status: params[:status]
}
options = exist_opts.merge(options)
......
......@@ -38,4 +38,13 @@ class GroupMilestone
rescue ZeroDivisionError
100
end
def state
state = milestones.map{ |milestone| milestone.state }
if state.all?{ |milestone_state| milestone_state == 'active' }
'active'
else
'closed'
end
end
end
= form_tag group_filter_path(entity), method: 'get' do
%fieldset
%ul.nav.nav-pills.nav-stacked
%li{class: ("active" if !params[:status])}
= link_to group_filter_path(entity, status: nil) do
%li{class: ("active" if (params[:status] == 'active' || !params[:status]))}
= link_to group_filter_path(entity, status: 'active') do
Active
%li{class: ("active" if params[:status] == 'closed')}
= link_to group_filter_path(entity, status: 'closed') do
......
......@@ -13,7 +13,7 @@
.fixed.sidebar-expand-button.hidden-lg.hidden-md
%i.icon-list.icon-2x
.col-md-3.responsive-side
= render 'groups/filter', entity: 'milestones'
= render 'groups/filter', entity: 'milestone'
.col-md-9
.panel.panel-default
%ul.well-list
......@@ -22,27 +22,25 @@
.nothing-here-block No milestones to show
- else
- @group_milestones.each do |milestone|
%li{class: "milestone milestone-open", id: 1 }
.pull-right
= link_to 'Close Milestone', root_path, method: :put, remote: true, class: "btn btn-small btn-remove"
%li{class: "milestone milestone-#{milestone.state == 'closed' ? 'closed' : 'open'}", id: dom_id(milestone.milestones.first) }
- unless milestone.state == 'closed'
.pull-right
= link_to 'Close Milestone', root_path, method: :put, remote: true, class: "btn btn-small btn-remove"
%h4
= link_to_gfm truncate(milestone.title, length: 100), root_path
- if false
%span.muted Empty
- else
%div
%div
%div
= link_to root_path do
= pluralize milestone.issue_count, 'Issue'
&nbsp;
= link_to root_path do
= pluralize milestone.merge_requests_count, 'Merge Request'
&nbsp;
%span.light #{milestone.percent_complete}% complete
.progress.progress-info
.progress-bar{style: "width: #{milestone.percent_complete}%;"}
%div
%br
- milestone.project_names.each do |name|
%span.label.label-default
= name
= link_to root_path do
= pluralize milestone.issue_count, 'Issue'
&nbsp;
= link_to root_path do
= pluralize milestone.merge_requests_count, 'Merge Request'
&nbsp;
%span.light #{milestone.percent_complete}% complete
.progress.progress-info
.progress-bar{style: "width: #{milestone.percent_complete}%;"}
%div
%br
- milestone.project_names.each do |name|
%span.label.label-default
= name
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