diff --git a/app/assets/stylesheets/base/gl_bootstrap.scss b/app/assets/stylesheets/base/gl_bootstrap.scss index 427f333423c..21acbfa5e5a 100644 --- a/app/assets/stylesheets/base/gl_bootstrap.scss +++ b/app/assets/stylesheets/base/gl_bootstrap.scss @@ -137,6 +137,12 @@ color: #666; } +.nav-pills > .active > a > span > .badge { + background-color: #fff; + color: $gl-primary; +} + + /** * fix to keep tooltips position in top navigation bar * diff --git a/app/views/layouts/nav/_search.html.haml b/app/views/layouts/nav/_search.html.haml deleted file mode 100644 index f95f6acb28d..00000000000 --- a/app/views/layouts/nav/_search.html.haml +++ /dev/null @@ -1,30 +0,0 @@ -- if @search_term - %ul.nav.nav-sidebar.search-filter - - if @project - = render 'layouts/nav/search/project' - - - elsif @show_snippets - = render 'layouts/nav/search/snippet' - - - else - %li{class: ("active" if @scope == 'projects')} - = link_to search_filter_path(scope: 'projects') do - = icon('bookmark fw') - %span - Projects - %span.count - = @search_results.projects_count - %li{class: ("active" if @scope == 'issues')} - = link_to search_filter_path(scope: 'issues') do - = icon('exclamation-circle fw') - %span - Issues - %span.count - = @search_results.issues_count - %li{class: ("active" if @scope == 'merge_requests')} - = link_to search_filter_path(scope: 'merge_requests') do - = icon('tasks fw') - %span - Merge requests - %span.count - = @search_results.merge_requests_count diff --git a/app/views/layouts/nav/search/_project.html.haml b/app/views/layouts/nav/search/_project.html.haml deleted file mode 100644 index 344cb4b4801..00000000000 --- a/app/views/layouts/nav/search/_project.html.haml +++ /dev/null @@ -1,35 +0,0 @@ -%li{class: ("active" if @scope == 'blobs')} - = link_to search_filter_path(scope: 'blobs') do - = icon('code fw') - %span - Code - %span.count - = @search_results.blobs_count -%li{class: ("active" if @scope == 'issues')} - = link_to search_filter_path(scope: 'issues') do - = icon('exclamation-circle fw') - %span - Issues - %span.count - = @search_results.issues_count -%li{class: ("active" if @scope == 'merge_requests')} - = link_to search_filter_path(scope: 'merge_requests') do - = icon('tasks fw') - %span - Merge requests - %span.count - = @search_results.merge_requests_count -%li{class: ("active" if @scope == 'notes')} - = link_to search_filter_path(scope: 'notes') do - = icon('comments fw') - %span - Comments - %span.count - = @search_results.notes_count -%li{class: ("active" if @scope == 'wiki_blobs')} - = link_to search_filter_path(scope: 'wiki_blobs') do - = icon('book fw') - %span - Wiki - %span.count - = @search_results.wiki_blobs_count diff --git a/app/views/layouts/nav/search/_snippet.html.haml b/app/views/layouts/nav/search/_snippet.html.haml deleted file mode 100644 index e63a221fb82..00000000000 --- a/app/views/layouts/nav/search/_snippet.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -%li{class: ("active" if @scope == 'snippet_blobs')} - = link_to search_filter_path(scope: 'snippet_blobs', snippets: true, group_id: nil, project_id: nil) do - = icon('code fw') - %span - Snippet Contents - %span.count - = @search_results.snippet_blobs_count -%li{class: ("active" if @scope == 'snippet_titles')} - = link_to search_filter_path(scope: 'snippet_titles', snippets: true, group_id: nil, project_id: nil) do - = icon('book fw') - %span - Titles and Filenames - %span.count - = @search_results.snippet_titles_count diff --git a/app/views/layouts/search.html.haml b/app/views/layouts/search.html.haml index c9b76e8fca4..4b526686be4 100644 --- a/app/views/layouts/search.html.haml +++ b/app/views/layouts/search.html.haml @@ -3,4 +3,4 @@ = render "layouts/head", title: "Search" %body{class: "#{app_theme} application", :'data-page' => body_data_page} = render "layouts/head_panel", title: link_to("Search", search_path) - = render 'layouts/page', sidebar: 'layouts/nav/search' + = render 'layouts/page' diff --git a/app/views/search/_category.html.haml b/app/views/search/_category.html.haml new file mode 100644 index 00000000000..154332cb9a9 --- /dev/null +++ b/app/views/search/_category.html.haml @@ -0,0 +1,77 @@ +%ul.nav.nav-pills.search-filter + - if @project + %li{class: ("active" if @scope == 'blobs')} + = link_to search_filter_path(scope: 'blobs') do + = icon('code fw') + %span + Code + %span.badge + = @search_results.blobs_count + %li{class: ("active" if @scope == 'issues')} + = link_to search_filter_path(scope: 'issues') do + = icon('exclamation-circle fw') + %span + Issues + %span.badge + = @search_results.issues_count + %li{class: ("active" if @scope == 'merge_requests')} + = link_to search_filter_path(scope: 'merge_requests') do + = icon('tasks fw') + %span + Merge requests + %span.badge + = @search_results.merge_requests_count + %li{class: ("active" if @scope == 'notes')} + = link_to search_filter_path(scope: 'notes') do + = icon('comments fw') + %span + Comments + %span.badge + = @search_results.notes_count + %li{class: ("active" if @scope == 'wiki_blobs')} + = link_to search_filter_path(scope: 'wiki_blobs') do + = icon('book fw') + %span + Wiki + %span.badge + = @search_results.wiki_blobs_count + + - elsif @show_snippets + %li{class: ("active" if @scope == 'snippet_blobs')} + = link_to search_filter_path(scope: 'snippet_blobs', snippets: true, group_id: nil, project_id: nil) do + = icon('code fw') + %span + Snippet Contents + %span.badge + = @search_results.snippet_blobs_count + %li{class: ("active" if @scope == 'snippet_titles')} + = link_to search_filter_path(scope: 'snippet_titles', snippets: true, group_id: nil, project_id: nil) do + = icon('book fw') + %span + Titles and Filenames + %span.badge + = @search_results.snippet_titles_count + + - else + %li{class: ("active" if @scope == 'projects')} + = link_to search_filter_path(scope: 'projects') do + = icon('bookmark fw') + %span + Projects + %span.badge + = @search_results.projects_count + %li{class: ("active" if @scope == 'issues')} + = link_to search_filter_path(scope: 'issues') do + = icon('exclamation-circle fw') + %span + Issues + %span.badge + = @search_results.issues_count + %li{class: ("active" if @scope == 'merge_requests')} + = link_to search_filter_path(scope: 'merge_requests') do + = icon('tasks fw') + %span + Merge requests + %span.badge + = @search_results.merge_requests_count + diff --git a/app/views/search/_form.html.haml b/app/views/search/_form.html.haml index a9ec7df2967..47016daf1f0 100644 --- a/app/views/search/_form.html.haml +++ b/app/views/search/_form.html.haml @@ -6,7 +6,7 @@ .search-holder.clearfix .form-group = search_field_tag :search, params[:search], placeholder: "Search for projects, issues etc", class: "form-control search-text-input input-mn-300", id: "dashboard_search", autofocus: true - = button_tag 'Search', class: "btn btn-info" + = button_tag 'Search', class: "btn btn-primary" - unless params[:snippets].eql? 'true' .pull-right = render 'filter' diff --git a/app/views/search/show.html.haml b/app/views/search/show.html.haml index 8e11154279f..e9f2711be2a 100644 --- a/app/views/search/show.html.haml +++ b/app/views/search/show.html.haml @@ -1,4 +1,6 @@ = render 'search/form' %hr - if @search_term + = render 'search/category' + %hr = render 'search/results'