%ul.nav.nav-tabs
  %li{class: ("active" if params[:search_code].present?)}
    = link_to search_path(params.merge(search_code: true)) do
      Repository Code
  %li{class: ("active" if params[:search_code].blank?)}
    = link_to search_path(params.merge(search_code: nil)) do
      Issues and Merge requests

.search_results
  - if params[:search_code].present?
    .blob-results
      - if !@search_results[:blobs].empty?
        = render partial: "search/results/blob", collection: @search_results[:blobs]
        = paginate @search_results[:blobs], theme: 'gitlab'
      - else
        = render partial: "search/results/empty", :locals => { message: "We couldn't find any matching code" }
  - else
    - if (@search_results[:merge_requests] || @search_results[:issues] || @search_results[:notes]).length > 0
      %ul.bordered-list
        = render partial: "search/results/merge_request", collection: @search_results[:merge_requests]
        = render partial: "search/results/issue", collection: @search_results[:issues]
        = render partial: "search/results/note", collection: @search_results[:notes]
    - else
      = render partial: "search/results/empty", :locals => { message: "We couldn't find any issues, merge requests or notes" }

%ul.nav.nav-tabs
  %li{class: ("active" if params[:search_code].present?)}
    = link_to search_path(params.merge(search_code: true)) do
      Repository Code
  %li{class: ("active" if params[:search_code].blank?)}
    = link_to search_path(params.merge(search_code: nil)) do
      Issues and Merge requests

.search_results
  - if params[:search_code].present?
    .blob-results
      - if !@search_results[:blobs].empty?
        = render partial: "search/results/blob", collection: @search_results[:blobs]
        = paginate @search_results[:blobs], theme: 'gitlab'
      - else
        = render partial: "search/results/empty", :locals => { message: "We couldn't find any matching code" }
  - else
    - if @search_results[:merge_requests].present? || @search_results[:issues].present? || @search_results[:notes].present?
      %ul.bordered-list
        = render partial: "search/results/merge_request", collection: @search_results[:merge_requests]
        = render partial: "search/results/issue", collection: @search_results[:issues]
        = render partial: "search/results/note", collection: @search_results[:notes]
    - else
      = render partial: "search/results/empty", locals: { message: "We couldn't find any issues, merge requests or notes" }

Fix project search showing always no results if no merge requests matches
Fix project search showing always no results if no merge requests matches

Signed-off-by: Dmitriy Zaporozhets <be23d75b156792e5acab51b196a2deb155d35d6a@gmail.com>
