diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-01-18 14:16:46 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-01-18 14:16:46 +0200 |
commit | 073a269831d5bf6d9b9c55d91826d87721746bc9 (patch) | |
tree | 8f25693fc6b18ee11ff8d9e744c81534189e412d /app/controllers/search_controller.rb | |
parent | 4d7792bc388d72a8ce6c2f84e102ba68a28dae81 (diff) | |
download | gitlab-ce-073a269831d5bf6d9b9c55d91826d87721746bc9.tar.gz |
Refactor search autocomplete. Use ajax for source
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/controllers/search_controller.rb')
-rw-r--r-- | app/controllers/search_controller.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index e853c22800a..0152d53f7fc 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -1,4 +1,6 @@ class SearchController < ApplicationController + include SearchHelper + def show @project = Project.find_by_id(params[:project_id]) if params[:project_id].present? @group = Group.find_by_id(params[:group_id]) if params[:group_id].present? @@ -10,4 +12,12 @@ class SearchController < ApplicationController @search_results = Search::GlobalService.new(current_user, params).execute end end + + def autocomplete + term = params[:term] + @project = Project.find(params[:project_id]) if params[:project_id].present? + @ref = params[:project_ref] if params[:project_ref].present? + + render json: search_autocomplete_opts(term).to_json + end end |