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

43 lines
991 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]
2017-08-17 22:00:37 +05:30
before_action :set_show_full_reference, 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
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"
2017-09-10 17:25:29 +05:30
ProjectsFinder.new(current_user: current_user, params: { starred: true }).execute
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
2017-09-10 17:25:29 +05:30
@events = EventCollection
.new(projects, offset: params[:offset].to_i, filter: @event_filter)
.to_a
2018-03-17 18:26:18 +05:30
Events::RenderService.new(current_user).execute(@events)
2014-09-02 18:07:02 +05:30
end
2017-08-17 22:00:37 +05:30
def set_show_full_reference
@show_full_reference = true
end
2014-09-02 18:07:02 +05:30
end