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"
|
|
|
|
current_user.starred_projects
|
|
|
|
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
|
2015-11-26 14:37:03 +05:30
|
|
|
|
|
|
|
def projects
|
|
|
|
@projects ||= current_user.authorized_projects.sorted_by_activity.non_archived
|
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|