BigW Consortium Gitlab

dashboard_controller.rb 929 Bytes
Newer Older
1
class DashboardController < Dashboard::ApplicationController
2 3 4
  include IssuesAction
  include MergeRequestsAction

5
  before_action :event_filter, only: :activity
6
  before_action :projects, only: [:issues, :merge_requests]
7
  before_action :set_show_full_reference, only: [:issues, :merge_requests]
8

9
  respond_to :html
10

11 12 13 14 15 16 17 18 19 20 21
  def activity
    respond_to do |format|
      format.html

      format.json do
        load_events
        pager_json("events/_events", @events.count)
      end
    end
  end

22 23
  protected

24
  def load_events
25
    projects =
26
      if params[:filter] == "starred"
27
        ProjectsFinder.new(current_user: current_user, params: { starred: true }).execute
28 29
      else
        current_user.authorized_projects
30
      end
31

32 33 34
    @events = EventCollection
      .new(projects, offset: params[:offset].to_i, filter: @event_filter)
      .to_a
35
  end
36 37 38 39

  def set_show_full_reference
    @show_full_reference = true
  end
gitlabhq committed
40
end