2012-03-15 19:14:39 -04:00
|
|
|
class SearchController < ApplicationController
|
|
|
|
def show
|
|
|
|
query = params[:search]
|
|
|
|
if query.blank?
|
|
|
|
@projects = []
|
|
|
|
@merge_requests = []
|
2012-04-14 04:16:11 -04:00
|
|
|
@issues = []
|
2012-03-15 19:14:39 -04:00
|
|
|
else
|
2012-04-14 04:16:11 -04:00
|
|
|
@projects = current_user.projects.search(query).limit(10)
|
|
|
|
@merge_requests = MergeRequest.where(:project_id => current_user.project_ids).search(query).limit(10)
|
|
|
|
@issues = Issue.where(:project_id => current_user.project_ids).search(query).limit(10)
|
2012-03-15 19:14:39 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|