BigW Consortium Gitlab

dashboard_controller.rb 984 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
    @events = Event.in_projects(projects)
33 34 35
    @events = @event_filter.apply_filter(@events).with_associations
    @events = @events.limit(20).offset(params[:offset] || 0)
  end
36 37 38 39

  def set_show_full_reference
    @show_full_reference = true
  end
gitlabhq committed
40
end