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 22 23
  def activity
    @last_push = current_user.recent_push

    respond_to do |format|
      format.html

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

24 25
  protected

26
  def load_events
27
    projects =
28
      if params[:filter] == "starred"
29
        current_user.viewable_starred_projects
30 31
      else
        current_user.authorized_projects
32
      end
33

34
    @events = Event.in_projects(projects)
35 36 37
    @events = @event_filter.apply_filter(@events).with_associations
    @events = @events.limit(20).offset(params[:offset] || 0)
  end
38 39 40 41

  def set_show_full_reference
    @show_full_reference = true
  end
gitlabhq committed
42
end