Improve comment search results
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
13f6dc1a94
commit
7e59a8fee8
5 changed files with 35 additions and 14 deletions
|
@ -103,4 +103,9 @@ module SearchHelper
|
||||||
options = exist_opts.merge(options)
|
options = exist_opts.merge(options)
|
||||||
search_path(options)
|
search_path(options)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Sanitize html generated after parsing markdown from issue description or comment
|
||||||
|
def search_md_sanitize(html)
|
||||||
|
sanitize(html, tags: %w(a p ul li pre code))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -22,6 +22,6 @@
|
||||||
- if @search_results.empty?
|
- if @search_results.empty?
|
||||||
= render partial: "search/results/empty", locals: { message: "We couldn't find any matching results" }
|
= render partial: "search/results/empty", locals: { message: "We couldn't find any matching results" }
|
||||||
|
|
||||||
%ul.bordered-list
|
%ul.bordered-list.top-list
|
||||||
= render partial: "search/results/#{@scope.singularize}", collection: @objects
|
= render partial: "search/results/#{@scope.singularize}", collection: @objects
|
||||||
= paginate @objects, theme: 'gitlab'
|
= paginate @objects, theme: 'gitlab'
|
||||||
|
|
|
@ -31,6 +31,6 @@
|
||||||
- if @search_results.empty?
|
- if @search_results.empty?
|
||||||
= render partial: "search/results/empty", locals: { message: "We couldn't find any matching results" }
|
= render partial: "search/results/empty", locals: { message: "We couldn't find any matching results" }
|
||||||
|
|
||||||
%ul.bordered-list
|
%ul.bordered-list.top-list
|
||||||
= render partial: "search/results/#{@scope.singularize}", collection: @objects
|
= render partial: "search/results/#{@scope.singularize}", collection: @objects
|
||||||
= paginate @objects, theme: 'gitlab'
|
= paginate @objects, theme: 'gitlab'
|
||||||
|
|
|
@ -1,9 +1,26 @@
|
||||||
|
- project = note.project
|
||||||
%li
|
%li
|
||||||
note on issue:
|
%h5.note-search-caption
|
||||||
= link_to [note.project, note.noteable] do
|
%i.icon-comment
|
||||||
%span ##{note.noteable.iid}
|
= link_to_member(project, note.author, avatar: false)
|
||||||
%strong.term
|
commented on
|
||||||
= truncate note.noteable.title, length: 50
|
|
||||||
%span.light (#{note.project.name_with_namespace})
|
- if note.for_commit?
|
||||||
- if note.noteable.closed?
|
= link_to project do
|
||||||
%span.label Closed
|
= project.name_with_namespace
|
||||||
|
·
|
||||||
|
= link_to project_commit_path(project, note.commit_id, anchor: dom_id(note)) do
|
||||||
|
Commit #{note.commit_id[0..8]}
|
||||||
|
- else
|
||||||
|
= link_to project do
|
||||||
|
= project.name_with_namespace
|
||||||
|
·
|
||||||
|
%span #{note.noteable_type.titleize} ##{note.noteable.iid}
|
||||||
|
·
|
||||||
|
= link_to [project, note.noteable, anchor: dom_id(note)] do
|
||||||
|
= note.noteable.title
|
||||||
|
|
||||||
|
.note-search-result
|
||||||
|
.term
|
||||||
|
= preserve do
|
||||||
|
= search_md_sanitize(markdown(note.note, {no_header_anchors: true}))
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
%li
|
%li
|
||||||
project:
|
%h4
|
||||||
= link_to project do
|
= link_to project do
|
||||||
%strong.term= project.name_with_namespace
|
%span.term= project.name_with_namespace
|
||||||
- if project.description.present?
|
- if project.description.present?
|
||||||
–
|
|
||||||
%span.light.term= project.description
|
%span.light.term= project.description
|
||||||
|
|
Loading…
Reference in a new issue