debian-mirror-gitlab/app/controllers/dashboard_controller.rb

38 lines
840 B
Ruby
Raw Normal View History

2015-09-11 14:41:01 +05:30
class DashboardController < Dashboard::ApplicationController
2015-12-23 02:04:40 +05:30
include IssuesAction
include MergeRequestsAction
2015-09-25 12:07:36 +05:30
before_action :event_filter, only: :activity
2015-11-26 14:37:03 +05:30
before_action :projects, only: [:issues, :merge_requests]
2014-09-02 18:07:02 +05:30
2015-09-11 14:41:01 +05:30
respond_to :html
2014-09-02 18:07:02 +05:30
2015-09-25 12:07:36 +05:30
def activity
@last_push = current_user.recent_push
2014-09-02 18:07:02 +05:30
2015-09-25 12:07:36 +05:30
respond_to do |format|
format.html
format.json do
load_events
pager_json("events/_events", @events.count)
end
end
2014-09-02 18:07:02 +05:30
end
2015-09-25 12:07:36 +05:30
protected
2015-04-26 12:48:37 +05:30
def load_events
2016-04-02 18:10:28 +05:30
projects =
2015-09-25 12:07:36 +05:30
if params[:filter] == "starred"
2016-06-02 11:05:42 +05:30
current_user.viewable_starred_projects
2015-09-25 12:07:36 +05:30
else
current_user.authorized_projects
2016-04-02 18:10:28 +05:30
end
2015-09-25 12:07:36 +05:30
2016-04-02 18:10:28 +05:30
@events = Event.in_projects(projects)
2015-04-26 12:48:37 +05:30
@events = @event_filter.apply_filter(@events).with_associations
@events = @events.limit(20).offset(params[:offset] || 0)
2014-09-02 18:07:02 +05:30
end
end