summaryrefslogtreecommitdiff
path: root/app/controllers/dashboard/milestones_controller.rb
blob: 7f506db583f5d36f3a5cafa5241c6e9b793ca0c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
class Dashboard::MilestonesController < Dashboard::ApplicationController
  before_action :projects
  before_action :milestone, only: [:show]

  def index
    respond_to do |format|
      format.html do
        @milestones = Kaminari.paginate_array(milestones).page(params[:page])
      end
      format.json do
        render json: milestones
      end
    end
  end

  def show
  end

  private

  def milestones
    @milestones = DashboardMilestone.build_collection(@projects, params)
  end

  def milestone
    @milestone = DashboardMilestone.build(@projects, params[:title])
    render_404 unless @milestone
  end
end