diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-08-28 11:06:19 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-08-28 11:06:19 +0300 |
commit | 1056d91c67750e11973064932de28d49ea1debec (patch) | |
tree | 3e17ebe8f76123fa72cef26a9d5182485428570e /app/views/search | |
parent | c9054319c8f64e7f91cf062e36434da78979fa76 (diff) | |
download | gitlab-ce-1056d91c67750e11973064932de28d49ea1debec.tar.gz |
Improve search results output. Fixes some markup issues
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/views/search')
-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 |
9 files changed, 60 insertions, 73 deletions
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 |