Commit 2940785c authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Add sort dropdown to merge requests list

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 2c071314
......@@ -30,6 +30,9 @@ class MergeRequestsLoadContext < BaseContext
merge_requests = merge_requests.where(milestone_id: (params[:milestone_id] == '0' ? nil : params[:milestone_id]))
end
# Sort by :sort param
merge_requests = merge_requests.sort(params[:sort])
merge_requests
end
end
......@@ -17,6 +17,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
before_filter :authorize_modify_merge_request!, only: [:close, :edit, :update, :sort]
def index
sort_param = params[:sort] || 'newest'
@sort = sort_param.humanize unless sort_param.empty?
@merge_requests = MergeRequestsLoadContext.new(project, current_user, params).execute
assignee_id, milestone_id = params[:assignee_id], params[:milestone_id]
@assignee = @project.team.find(assignee_id) if assignee_id.present? && !assignee_id.to_i.zero?
......
......@@ -60,6 +60,8 @@
%strong= milestone.title
%small.light= milestone.expires_at
= render 'shared/sort_dropdown'
%ul.well-list.mr-list
= render @merge_requests
- if @merge_requests.blank?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment