BigW Consortium Gitlab

Commit 9d9b7882 by Dmitriy Zaporozhets

Fix paginate of blobs, fixed preserve in dev mode for blob results

parent 46daf01a
......@@ -17,14 +17,7 @@ class SearchContext
project = projects.first if projects.length == 1
if params[:search_code].present?
blobs = []
unless project.empty_repo?
blobs = project.repository.search_files(query, params[:repository_ref])
blobs = Kaminari.paginate_array(blobs).page(params[:page]).per(20)
end
result[:blobs] = blobs
result[:blobs] = project.repository.search_files(query, params[:repository_ref]) unless project.empty_repo?
else
result[:merge_requests] = MergeRequest.where(project_id: project_ids).search(query).limit(10)
result[:issues] = Issue.where(project_id: project_ids).search(query).limit(10)
......
......@@ -20,6 +20,7 @@ class SearchController < ApplicationController
@merge_requests = result[:merge_requests]
@issues = result[:issues]
@wiki_pages = result[:wiki_pages]
@blobs = result[:blobs]
@blobs = Kaminari.paginate_array(result[:blobs]).page(params[:page]).per(20)
@total_results = @projects.count + @merge_requests.count + @issues.count + @wiki_pages.count + @blobs.total_count
end
end
......@@ -7,4 +7,5 @@
= blob.filename
.file_content.code.term
%div{class: user_color_scheme_class}
= raw blob.colorize( formatter: :gitlab, options: { first_line_number: blob.startline } )
= preserve do
= raw blob.colorize( formatter: :gitlab, options: { first_line_number: blob.startline } )
%fieldset
%legend
Search results
%span.cgray (#{@projects.count + @merge_requests.count + @issues.count + @wiki_pages.count + @blobs.total_count})
%span.cgray (#{@total_results})
- if @project
%ul.nav.nav-pills
......@@ -12,7 +12,6 @@
= link_to search_path(params.merge(search_code: nil)) do
Everything else
.search_results
%ul.bordered-list
- @projects.each do |project|
......
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