2018-09-23 15:44:14 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-04-30 13:06:18 -04:00
|
|
|
class Dashboard::MilestonesController < Dashboard::ApplicationController
|
2017-06-08 12:43:05 -04:00
|
|
|
include MilestoneActions
|
|
|
|
|
2015-11-13 13:20:48 -05:00
|
|
|
before_action :projects
|
2017-06-08 12:43:05 -04:00
|
|
|
before_action :milestone, only: [:show, :merge_requests, :participants, :labels]
|
2015-03-03 10:19:37 -05:00
|
|
|
|
|
|
|
def index
|
2016-03-22 14:19:53 -04:00
|
|
|
respond_to do |format|
|
2016-03-23 04:09:58 -04:00
|
|
|
format.html do
|
2016-12-12 23:29:12 -05:00
|
|
|
@milestone_states = GlobalMilestone.states_count(@projects)
|
2016-03-23 04:09:58 -04:00
|
|
|
@milestones = Kaminari.paginate_array(milestones).page(params[:page])
|
|
|
|
end
|
2016-03-22 14:19:53 -04:00
|
|
|
format.json do
|
2016-03-23 04:09:58 -04:00
|
|
|
render json: milestones
|
2016-03-22 14:19:53 -04:00
|
|
|
end
|
|
|
|
end
|
2015-03-03 10:19:37 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def show
|
|
|
|
end
|
2017-01-06 07:47:18 -05:00
|
|
|
|
|
|
|
private
|
|
|
|
|
2018-08-03 15:52:37 -04:00
|
|
|
def group_milestones
|
2018-09-10 20:37:21 -04:00
|
|
|
groups = GroupsFinder.new(current_user, all_available: false).execute
|
2018-08-03 15:52:37 -04:00
|
|
|
|
|
|
|
DashboardGroupMilestone.build_collection(groups)
|
|
|
|
end
|
|
|
|
|
|
|
|
# See [#39545](https://gitlab.com/gitlab-org/gitlab-ce/issues/39545) for info about the deprecation of dynamic milestones
|
|
|
|
def dynamic_milestones
|
|
|
|
DashboardMilestone.build_collection(@projects, params)
|
|
|
|
end
|
|
|
|
|
2017-01-06 07:47:18 -05:00
|
|
|
def milestones
|
2018-08-03 15:52:37 -04:00
|
|
|
@milestones = group_milestones + dynamic_milestones
|
2017-01-06 07:47:18 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def milestone
|
2017-01-13 10:12:27 -05:00
|
|
|
@milestone = DashboardMilestone.build(@projects, params[:title])
|
2017-01-06 07:47:18 -05:00
|
|
|
render_404 unless @milestone
|
|
|
|
end
|
2015-03-03 10:19:37 -05:00
|
|
|
end
|