2012-03-16 00:14:39 +01:00
|
|
|
class SearchController < ApplicationController
|
|
|
|
def show
|
2013-01-25 09:07:21 +01:00
|
|
|
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
|
2012-07-31 07:32:49 +02:00
|
|
|
|
2012-10-09 21:09:46 +02:00
|
|
|
@projects = result[:projects]
|
|
|
|
@merge_requests = result[:merge_requests]
|
|
|
|
@issues = result[:issues]
|
2012-10-16 21:05:11 +02:00
|
|
|
@wiki_pages = result[:wiki_pages]
|
2012-03-16 00:14:39 +01:00
|
|
|
end
|
|
|
|
end
|