Commit db881906 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'improve-search-output' into 'master'

Improve search output

See merge request !1046
parents c9bf3581 1056d91c
.search-results {
.search-result-row {
border-bottom: 1px solid #EEE;
padding-bottom: 10px;
margin-bottom: 10px;
}
}
...@@ -106,6 +106,6 @@ module SearchHelper ...@@ -106,6 +106,6 @@ module SearchHelper
# Sanitize html generated after parsing markdown from issue description or comment # Sanitize html generated after parsing markdown from issue description or comment
def search_md_sanitize(html) def search_md_sanitize(html)
sanitize(html, tags: %w(a p ul li pre code)) sanitize(html, tags: %w(a p ol ul li pre code))
end end
end end
%ul.nav.nav-pills.nav-stacked.search-filter
%li{class: ("active" if @scope == 'projects')}
= link_to search_filter_path(scope: 'projects') do
Projects
.pull-right
= @search_results.projects_count
%li{class: ("active" if @scope == 'issues')}
= link_to search_filter_path(scope: 'issues') do
Issues
.pull-right
= @search_results.issues_count
%li{class: ("active" if @scope == 'merge_requests')}
= link_to search_filter_path(scope: 'merge_requests') do
Merge requests
.pull-right
= @search_results.merge_requests_count
.row
.col-sm-3
%ul.nav.nav-pills.nav-stacked.search-filter
%li{class: ("active" if @scope == 'projects')}
= link_to search_filter_path(scope: 'projects') do
Projects
.pull-right
= @search_results.projects_count
%li{class: ("active" if @scope == 'issues')}
= link_to search_filter_path(scope: 'issues') do
Issues
.pull-right
= @search_results.issues_count
%li{class: ("active" if @scope == 'merge_requests')}
= link_to search_filter_path(scope: 'merge_requests') do
Merge requests
.pull-right
= @search_results.merge_requests_count
.col-sm-9
.search_results
- if @search_results.empty?
= render partial: "search/results/empty", locals: { message: "We couldn't find any matching results" }
%ul.bordered-list.top-list
= render partial: "search/results/#{@scope.singularize}", collection: @objects
= paginate @objects, theme: 'gitlab'
%ul.nav.nav-pills.nav-stacked.search-filter
%li{class: ("active" if @scope == 'blobs')}
= link_to search_filter_path(scope: 'blobs') do
%i.icon-code
Code
.pull-right
= @search_results.blobs_count
%li{class: ("active" if @scope == 'issues')}
= link_to search_filter_path(scope: 'issues') do
%i.icon-exclamation-sign
Issues
.pull-right
= @search_results.issues_count
%li{class: ("active" if @scope == 'merge_requests')}
= link_to search_filter_path(scope: 'merge_requests') do
%i.icon-code-fork
Merge requests
.pull-right
= @search_results.merge_requests_count
%li{class: ("active" if @scope == 'notes')}
= link_to search_filter_path(scope: 'notes') do
%i.icon-comments
Comments
.pull-right
= @search_results.notes_count
.row
.col-sm-3
%ul.nav.nav-pills.nav-stacked.search-filter
%li{class: ("active" if @scope == 'blobs')}
= link_to search_filter_path(scope: 'blobs') do
%i.icon-code
Code
.pull-right
= @search_results.blobs_count
%li{class: ("active" if @scope == 'issues')}
= link_to search_filter_path(scope: 'issues') do
%i.icon-exclamation-sign
Issues
.pull-right
= @search_results.issues_count
%li{class: ("active" if @scope == 'merge_requests')}
= link_to search_filter_path(scope: 'merge_requests') do
%i.icon-code-fork
Merge requests
.pull-right
= @search_results.merge_requests_count
%li{class: ("active" if @scope == 'notes')}
= link_to search_filter_path(scope: 'notes') do
%i.icon-comments
Comments
.pull-right
= @search_results.notes_count
.col-sm-9
.search_results
- if @search_results.empty?
= render partial: "search/results/empty", locals: { message: "We couldn't find any matching results" }
%ul.bordered-list.top-list
= render partial: "search/results/#{@scope.singularize}", collection: @objects
= paginate @objects, theme: 'gitlab'
...@@ -7,10 +7,19 @@ ...@@ -7,10 +7,19 @@
%hr %hr
- if @project .row
= render "project_results" .col-sm-3
- else - if @project
= render "global_results" = render "project_filter"
- else
= render "global_filter"
.col-sm-9
.search-results
- if @search_results.empty?
= render partial: "search/results/empty", locals: { message: "We couldn't find any matching results" }
- else
= render partial: "search/results/#{@scope.singularize}", collection: @objects
= paginate @objects, theme: 'gitlab'
:javascript :javascript
$(".search_results .term").highlight("#{escape_javascript(params[:search])}"); $(".search-results .term").highlight("#{escape_javascript(params[:search])}");
%li .search-result-row
%h4 %h4
= link_to [issue.project, issue] do = link_to [issue.project, issue] do
%span.term.str-truncated= issue.title %span.term.str-truncated= issue.title
......
%li .search-result-row
%h4 %h4
= link_to [merge_request.target_project, merge_request] do = link_to [merge_request.target_project, merge_request] do
%span.term.str-truncated= merge_request.title %span.term.str-truncated= merge_request.title
......
- project = note.project - project = note.project
%li .search-result-row
%h5.note-search-caption %h5.note-search-caption.str-truncated
%i.icon-comment %i.icon-comment
= link_to_member(project, note.author, avatar: false) = link_to_member(project, note.author, avatar: false)
commented on commented on
......
%li .search-result-row
%h4 %h4
= link_to project do = link_to project do
%span.term= project.name_with_namespace %span.term= project.name_with_namespace
......
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