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