BigW Consortium Gitlab

milestones_controller.rb 690 Bytes
Newer Older
1
class Dashboard::MilestonesController < Dashboard::ApplicationController
2 3
  before_action :projects
  before_action :milestone, only: [:show]
Douwe Maan committed
4 5

  def index
6
    respond_to do |format|
7
      format.html do
8
        @milestone_states = GlobalMilestone.states_count(@projects)
9 10
        @milestones = Kaminari.paginate_array(milestones).page(params[:page])
      end
11
      format.json do
12
        render json: milestones
13 14
      end
    end
Douwe Maan committed
15 16 17 18
  end

  def show
  end
19 20 21 22

  private

  def milestones
23
    @milestones = DashboardMilestone.build_collection(@projects, params)
24 25 26
  end

  def milestone
27
    @milestone = DashboardMilestone.build(@projects, params[:title])
28 29
    render_404 unless @milestone
  end
Douwe Maan committed
30
end