gitlab-org--gitlab-foss/app/controllers/dashboard/milestones_controller.rb

35 lines
844 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2015-04-30 13:06:18 -04:00
class Dashboard::MilestonesController < Dashboard::ApplicationController
before_action :projects
before_action :groups, only: :index
2015-03-03 10:19:37 -05:00
feature_category :issue_tracking
2015-03-03 10:19:37 -05:00
def index
respond_to do |format|
format.html do
@milestone_states = Milestone.states_count(@projects.select(:id), groups.select(:id))
@milestones = milestones.page(params[:page])
end
format.json do
render json: milestones.to_json(only: [:id, :title], methods: :name)
end
end
2015-03-03 10:19:37 -05:00
end
private
def milestones
MilestonesFinder.new(search_params).execute
end
def groups
@groups ||= GroupsFinder.new(current_user, all_available: false).execute
end
def search_params
params.permit(:state, :search_title).merge(group_ids: groups, project_ids: projects)
end
2015-03-03 10:19:37 -05:00
end