BigW Consortium Gitlab

Use FilteringService for project issuus, mrs

parent 4a5e4b18
...@@ -116,7 +116,10 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -116,7 +116,10 @@ class Projects::IssuesController < Projects::ApplicationController
end end
def issues_filtered 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 end
# Since iids are implemented only in 6.1 # Since iids are implemented only in 6.1
......
...@@ -17,9 +17,15 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -17,9 +17,15 @@ class Projects::MergeRequestsController < Projects::ApplicationController
before_filter :authorize_modify_merge_request!, only: [:close, :edit, :update, :sort] before_filter :authorize_modify_merge_request!, only: [:close, :edit, :update, :sort]
def index def index
sort_param = params[:sort] || 'newest' params[:sort] ||= 'newest'
@sort = sort_param.humanize unless sort_param.empty? params[:scope] = 'all' if params[:scope].blank?
@merge_requests = MergeRequestsLoadContext.new(project, current_user, params).execute 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_id, milestone_id = params[:assignee_id], params[:milestone_id]
@assignee = @project.team.find(assignee_id) if assignee_id.present? && !assignee_id.to_i.zero? @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? @milestone = @project.milestones.find(milestone_id) if milestone_id.present? && !milestone_id.to_i.zero?
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
- if current_user - if current_user
%fieldset %fieldset
%ul.nav.nav-pills.nav-stacked %ul.nav.nav-pills.nav-stacked
%li{class: ("active" if params[:scope].blank?)} %li{class: ("active" if params[:scope] == 'all')}
= link_to project_filter_path(scope: nil) do = link_to project_filter_path(scope: 'all') do
Everyone's Everyone's
%li{class: ("active" if params[:scope] == 'assigned-to-me')} %li{class: ("active" if params[:scope] == 'assigned-to-me')}
= link_to project_filter_path(scope: 'assigned-to-me') do = link_to project_filter_path(scope: 'assigned-to-me') do
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
%fieldset %fieldset
%legend State %legend State
%ul.nav.nav-pills %ul.nav.nav-pills
%li{class: ("active" if params[:state].blank?)} %li{class: ("active" if params[:state] == 'opened')}
= link_to project_filter_path(state: nil) do = link_to project_filter_path(state: 'opened') do
Open Open
%li{class: ("active" if params[:state] == 'closed')} %li{class: ("active" if params[:state] == 'closed')}
= link_to project_filter_path(state: 'closed') do = 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