2012-10-09 21:09:46 +02:00
|
|
|
class MergeRequestsLoadContext < BaseContext
|
2012-07-20 07:39:34 +02:00
|
|
|
def execute
|
2012-08-30 21:15:34 +02:00
|
|
|
type = params[:f]
|
2012-07-20 07:39:34 +02:00
|
|
|
|
|
|
|
merge_requests = project.merge_requests
|
|
|
|
|
|
|
|
merge_requests = case type
|
2012-08-30 21:15:34 +02:00
|
|
|
when 'all' then merge_requests
|
|
|
|
when 'closed' then merge_requests.closed
|
|
|
|
when 'assigned-to-me' then merge_requests.opened.assigned(current_user)
|
2012-07-20 07:39:34 +02:00
|
|
|
else merge_requests.opened
|
|
|
|
end.page(params[:page]).per(20)
|
|
|
|
|
|
|
|
merge_requests.includes(:author, :project).order("closed, created_at desc")
|
|
|
|
end
|
|
|
|
end
|