diff options
-rw-r--r-- | app/assets/stylesheets/sections/search.scss | 7 | ||||
-rw-r--r-- | app/helpers/search_helper.rb | 2 | ||||
-rw-r--r-- | app/views/search/_global_filter.html.haml | 16 | ||||
-rw-r--r-- | app/views/search/_global_results.html.haml | 27 | ||||
-rw-r--r-- | app/views/search/_project_filter.html.haml | 25 | ||||
-rw-r--r-- | app/views/search/_project_results.html.haml | 36 | ||||
-rw-r--r-- | app/views/search/_results.html.haml | 19 | ||||
-rw-r--r-- | app/views/search/results/_issue.html.haml | 2 | ||||
-rw-r--r-- | app/views/search/results/_merge_request.html.haml | 2 | ||||
-rw-r--r-- | app/views/search/results/_note.html.haml | 4 | ||||
-rw-r--r-- | app/views/search/results/_project.html.haml | 2 |
11 files changed, 68 insertions, 74 deletions
diff --git a/app/assets/stylesheets/sections/search.scss b/app/assets/stylesheets/sections/search.scss new file mode 100644 index 00000000000..bdaa17ac339 --- /dev/null +++ b/app/assets/stylesheets/sections/search.scss @@ -0,0 +1,7 @@ +.search-results { + .search-result-row { + border-bottom: 1px solid #EEE; + padding-bottom: 10px; + margin-bottom: 10px; + } +} diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index 51b6812cac3..94e15c0f81c 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -106,6 +106,6 @@ module SearchHelper # 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)) + sanitize(html, tags: %w(a p ol ul li pre code)) end end diff --git a/app/views/search/_global_filter.html.haml b/app/views/search/_global_filter.html.haml new file mode 100644 index 00000000000..442bd84f930 --- /dev/null +++ b/app/views/search/_global_filter.html.haml @@ -0,0 +1,16 @@ +%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 diff --git a/app/views/search/_global_results.html.haml b/app/views/search/_global_results.html.haml deleted file mode 100644 index cedb6b249bb..00000000000 --- a/app/views/search/_global_results.html.haml +++ /dev/null @@ -1,27 +0,0 @@ -.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' diff --git a/app/views/search/_project_filter.html.haml b/app/views/search/_project_filter.html.haml new file mode 100644 index 00000000000..36947675d18 --- /dev/null +++ b/app/views/search/_project_filter.html.haml @@ -0,0 +1,25 @@ +%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 diff --git a/app/views/search/_project_results.html.haml b/app/views/search/_project_results.html.haml deleted file mode 100644 index fc047637b35..00000000000 --- a/app/views/search/_project_results.html.haml +++ /dev/null @@ -1,36 +0,0 @@ -.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' diff --git a/app/views/search/_results.html.haml b/app/views/search/_results.html.haml index 93bbe9cf7e9..f9c0a6d61ff 100644 --- a/app/views/search/_results.html.haml +++ b/app/views/search/_results.html.haml @@ -7,10 +7,19 @@ %hr -- if @project - = render "project_results" -- else - = render "global_results" +.row + .col-sm-3 + - if @project + = 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 - $(".search_results .term").highlight("#{escape_javascript(params[:search])}"); + $(".search-results .term").highlight("#{escape_javascript(params[:search])}"); diff --git a/app/views/search/results/_issue.html.haml b/app/views/search/results/_issue.html.haml index ac1566c9592..7868f958261 100644 --- a/app/views/search/results/_issue.html.haml +++ b/app/views/search/results/_issue.html.haml @@ -1,4 +1,4 @@ -%li +.search-result-row %h4 = link_to [issue.project, issue] do %span.term.str-truncated= issue.title diff --git a/app/views/search/results/_merge_request.html.haml b/app/views/search/results/_merge_request.html.haml index 7f6d765c1f3..56b185283bd 100644 --- a/app/views/search/results/_merge_request.html.haml +++ b/app/views/search/results/_merge_request.html.haml @@ -1,4 +1,4 @@ -%li +.search-result-row %h4 = link_to [merge_request.target_project, merge_request] do %span.term.str-truncated= merge_request.title diff --git a/app/views/search/results/_note.html.haml b/app/views/search/results/_note.html.haml index 6316212bc90..6a446538574 100644 --- a/app/views/search/results/_note.html.haml +++ b/app/views/search/results/_note.html.haml @@ -1,6 +1,6 @@ - project = note.project -%li - %h5.note-search-caption +.search-result-row + %h5.note-search-caption.str-truncated %i.icon-comment = link_to_member(project, note.author, avatar: false) commented on diff --git a/app/views/search/results/_project.html.haml b/app/views/search/results/_project.html.haml index 8c8baab8a5b..301b65eca29 100644 --- a/app/views/search/results/_project.html.haml +++ b/app/views/search/results/_project.html.haml @@ -1,4 +1,4 @@ -%li +.search-result-row %h4 = link_to project do %span.term= project.name_with_namespace |