Improved search. added filters
This commit is contained in:
parent
f6c482c06f
commit
ac8247b46d
7 changed files with 117 additions and 106 deletions
|
@ -1,6 +1,18 @@
|
|||
class SearchController < ApplicationController
|
||||
def show
|
||||
result = SearchContext.new(current_user.authorized_projects.map(&:id), params).execute
|
||||
project_id = params[:project_id]
|
||||
group_id = params[:group_id]
|
||||
|
||||
project_ids = current_user.authorized_projects.map(&:id)
|
||||
|
||||
if group_id.present?
|
||||
group_project_ids = Group.find(group_id).projects.map(&:id)
|
||||
project_ids.select! { |id| group_project_ids.include?(id)}
|
||||
elsif project_id.present?
|
||||
project_ids.select! { |id| id == project_id.to_i}
|
||||
end
|
||||
|
||||
result = SearchContext.new(project_ids, params).execute
|
||||
|
||||
@projects = result[:projects]
|
||||
@merge_requests = result[:merge_requests]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue