diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-08-27 12:37:31 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-08-27 12:37:31 +0300 |
commit | 7e59a8fee8c89d6217bd48bf1050526f59cb96aa (patch) | |
tree | 1063fd0093bbcbbe4e38df6299adb2777f0884b3 /app | |
parent | 13f6dc1a9476ef2c86538ede8420e915eb999a1c (diff) | |
download | gitlab-ce-7e59a8fee8c89d6217bd48bf1050526f59cb96aa.tar.gz |
Improve comment search results
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/search_helper.rb | 5 | ||||
-rw-r--r-- | app/views/search/_global_results.html.haml | 2 | ||||
-rw-r--r-- | app/views/search/_project_results.html.haml | 2 | ||||
-rw-r--r-- | app/views/search/results/_note.html.haml | 33 | ||||
-rw-r--r-- | app/views/search/results/_project.html.haml | 7 |
5 files changed, 35 insertions, 14 deletions
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index fff850c1fbb..51b6812cac3 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -103,4 +103,9 @@ module SearchHelper options = exist_opts.merge(options) search_path(options) 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 diff --git a/app/views/search/_global_results.html.haml b/app/views/search/_global_results.html.haml index 0225491e215..cedb6b249bb 100644 --- a/app/views/search/_global_results.html.haml +++ b/app/views/search/_global_results.html.haml @@ -22,6 +22,6 @@ - if @search_results.empty? = 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 = paginate @objects, theme: 'gitlab' diff --git a/app/views/search/_project_results.html.haml b/app/views/search/_project_results.html.haml index dd63d5d04cb..fc047637b35 100644 --- a/app/views/search/_project_results.html.haml +++ b/app/views/search/_project_results.html.haml @@ -31,6 +31,6 @@ - if @search_results.empty? = 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 = paginate @objects, theme: 'gitlab' diff --git a/app/views/search/results/_note.html.haml b/app/views/search/results/_note.html.haml index 97e892bdd4d..6316212bc90 100644 --- a/app/views/search/results/_note.html.haml +++ b/app/views/search/results/_note.html.haml @@ -1,9 +1,26 @@ +- project = note.project %li - note on issue: - = link_to [note.project, note.noteable] do - %span ##{note.noteable.iid} - %strong.term - = truncate note.noteable.title, length: 50 - %span.light (#{note.project.name_with_namespace}) - - if note.noteable.closed? - %span.label Closed + %h5.note-search-caption + %i.icon-comment + = link_to_member(project, note.author, avatar: false) + commented on + + - if note.for_commit? + = link_to project do + = 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})) diff --git a/app/views/search/results/_project.html.haml b/app/views/search/results/_project.html.haml index abc86c72bef..8c8baab8a5b 100644 --- a/app/views/search/results/_project.html.haml +++ b/app/views/search/results/_project.html.haml @@ -1,7 +1,6 @@ %li - project: - = link_to project do - %strong.term= project.name_with_namespace + %h4 + = link_to project do + %span.term= project.name_with_namespace - if project.description.present? - – %span.light.term= project.description |