Commit d618a5fe authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Refactor search views

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 593b05ea
.search_results
%ul.bordered-list
= render partial: "search/results/project", collection: @projects
= render partial: "search/results/merge_request", collection: @merge_requests
= render partial: "search/results/issue", collection: @issues
%ul.nav.nav-pills
%li{class: ("active" if params[:search_code].present?)}
= link_to search_path(params.merge(search_code: true)) do
Repository Code
%li{class: ("active" if params[:search_code].blank?)}
= link_to search_path(params.merge(search_code: nil)) do
Everything else
.search_results
- if params[:search_code].present?
.blob-results
= render partial: "search/results/blob", collection: @blobs
= paginate @blobs, theme: 'gitlab'
- else
%ul.bordered-list
= render partial: "search/results/merge_request", collection: @merge_requests
= render partial: "search/results/issue", collection: @issues
%fieldset
%legend
Search results
%span.cgray (#{@total_results})
- if @project
%ul.nav.nav-pills
%li{class: ("active" if params[:search_code].present?)}
= link_to search_path(params.merge(search_code: true)) do
Repository Code
%li{class: ("active" if params[:search_code].blank?)}
= link_to search_path(params.merge(search_code: nil)) do
Everything else
.search_results
%ul.bordered-list
- @projects.each do |project|
%li
project:
= link_to project do
%strong.term= project.name_with_namespace
- @merge_requests.each do |merge_request|
%li
merge request:
= link_to [merge_request.target_project, merge_request] do
%span ##{merge_request.iid}
%strong.term
= truncate merge_request.title, length: 50
- if merge_request.for_fork?
%span.light (#{merge_request.source_project.name_with_namespace}:#{merge_request.source_branch} &rarr; #{merge_request.target_project.name_with_namespace}:#{merge_request.target_branch})
- else
%span.light (#{merge_request.source_branch} &rarr; #{merge_request.target_branch})
- if merge_request.closed?
%span.label Closed
- @issues.each do |issue|
%li
issue:
= link_to [issue.project, issue] do
%span ##{issue.iid}
%strong.term
= truncate issue.title, length: 50
%span.light (#{issue.project.name_with_namespace})
- if issue.closed?
%span.label Closed
- @wiki_pages.each do |wiki_page|
%li
wiki:
= link_to project_wiki_path(wiki_page.project, wiki_page) do
%strong.term
= truncate wiki_page.title, length: 50
%span.light (#{wiki_page.project.name_with_namespace})
- @blobs.each do |blob|
= render 'blob', blob: blob
= paginate @blobs, theme: 'gitlab'
:javascript
$(".search_results .term").highlight("#{escape_javascript(params[:search])}");
%fieldset
%legend
Search results
%span.cgray (#{@total_results})
- if @project
= render "project_results"
- else
= render "global_results"
:javascript
$(".search_results .term").highlight("#{escape_javascript(params[:search])}");
%li
.blob-result
.file-holder
.file-title
= link_to project_blob_path(@project, tree_join(blob.ref, blob.filename), :anchor => "L" + blob.startline.to_s) do
......
%li
issue:
= link_to [issue.project, issue] do
%span ##{issue.iid}
%strong.term
= truncate issue.title, length: 50
%span.light (#{issue.project.name_with_namespace})
- if issue.closed?
%span.label Closed
%li
merge request:
= link_to [merge_request.target_project, merge_request] do
%span ##{merge_request.iid}
%strong.term
= truncate merge_request.title, length: 50
- if merge_request.for_fork?
%span.light (#{merge_request.source_project.name_with_namespace}:#{merge_request.source_branch} &rarr; #{merge_request.target_project.name_with_namespace}:#{merge_request.target_branch})
- else
%span.light (#{merge_request.source_branch} &rarr; #{merge_request.target_branch})
- if merge_request.closed?
%span.label Closed
%li
project:
= link_to project do
%strong.term= project.name_with_namespace
- if project.description.present?
&ndash;
%span.light.term= project.description
......@@ -13,4 +13,4 @@
.results.prepend-top-10
- if params[:search].present?
= render 'search/result'
= render 'search/results'
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