Commit 234b86c9 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Use FilteringService for project issuus, mrs

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 4a5e4b18
......@@ -116,7 +116,10 @@ class Projects::IssuesController < Projects::ApplicationController
end
def issues_filtered
@issues = Issues::ListContext.new(project, current_user, params).execute
params[:scope] = 'all' if params[:scope].blank?
params[:state] = 'opened' if params[:state].blank?
params[:project_id] = @project.id
@issues = FilteringService.new.execute(Issue, current_user, params)
end
# Since iids are implemented only in 6.1
......
......@@ -17,9 +17,15 @@ 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
params[:sort] ||= 'newest'
params[:scope] = 'all' if params[:scope].blank?
params[:state] = 'opened' if params[:state].blank?
params[:project_id] = @project.id
@merge_requests = FilteringService.new.execute(MergeRequest, current_user, params)
@merge_requests = @merge_requests.page(params[:page]).per(20)
@sort = params[:sort].humanize
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?
@milestone = @project.milestones.find(milestone_id) if milestone_id.present? && !milestone_id.to_i.zero?
......
......@@ -3,8 +3,8 @@
- if current_user
%fieldset
%ul.nav.nav-pills.nav-stacked
%li{class: ("active" if params[:scope].blank?)}
= link_to project_filter_path(scope: nil) do
%li{class: ("active" if params[:scope] == 'all')}
= link_to project_filter_path(scope: 'all') do
Everyone's
%li{class: ("active" if params[:scope] == 'assigned-to-me')}
= link_to project_filter_path(scope: 'assigned-to-me') do
......@@ -16,8 +16,8 @@
%fieldset
%legend State
%ul.nav.nav-pills
%li{class: ("active" if params[:state].blank?)}
= link_to project_filter_path(state: nil) do
%li{class: ("active" if params[:state] == 'opened')}
= link_to project_filter_path(state: 'opened') do
Open
%li{class: ("active" if params[:state] == 'closed')}
= link_to project_filter_path(state: 'closed') do
......
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