summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/helpers/search_helper.rb5
-rw-r--r--app/views/search/_filter.html.haml8
-rw-r--r--app/views/search/_global_results.html.haml2
-rw-r--r--app/views/search/_project_results.html.haml2
-rw-r--r--app/views/search/results/_merge_request.html.haml24
-rw-r--r--app/views/search/show.html.haml2
-rw-r--r--features/search.feature21
-rw-r--r--features/steps/project/search_code.rb3
8 files changed, 39 insertions, 28 deletions
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb
index 8c805f79c36..fff850c1fbb 100644
--- a/app/helpers/search_helper.rb
+++ b/app/helpers/search_helper.rb
@@ -101,9 +101,6 @@ module SearchHelper
}
options = exist_opts.merge(options)
-
- path = request.path
- path << "?#{options.to_param}"
- path
+ search_path(options)
end
end
diff --git a/app/views/search/_filter.html.haml b/app/views/search/_filter.html.haml
index 416ae8fc9f5..049aff0bc9b 100644
--- a/app/views/search/_filter.html.haml
+++ b/app/views/search/_filter.html.haml
@@ -9,11 +9,11 @@
%b.caret
%ul.dropdown-menu
%li
- = link_to search_path(group_id: nil, search: params[:search]) do
+ = link_to search_filter_path(group_id: nil) do
Any
- current_user.authorized_groups.sort_by(&:name).each do |group|
%li
- = link_to search_path(group_id: group.id, search: params[:search]) do
+ = link_to search_filter_path(group_id: group.id, project_id: nil) do
= group.name
.dropdown.inline.prepend-left-10.project-filter
@@ -27,9 +27,9 @@
%b.caret
%ul.dropdown-menu
%li
- = link_to search_path(project_id: nil, search: params[:search]) do
+ = link_to search_filter_path(project_id: nil) do
Any
- current_user.authorized_projects.sort_by(&:name_with_namespace).each do |project|
%li
- = link_to search_path(project_id: project.id, search: params[:search]) do
+ = link_to search_filter_path(project_id: project.id, group_id: nil) do
= project.name_with_namespace
diff --git a/app/views/search/_global_results.html.haml b/app/views/search/_global_results.html.haml
index 2d7968f8498..0225491e215 100644
--- a/app/views/search/_global_results.html.haml
+++ b/app/views/search/_global_results.html.haml
@@ -20,7 +20,7 @@
.col-sm-9
.search_results
- if @search_results.empty?
- = render partial: "search/results/empty", locals: { message: "We couldn't find any matchind results" }
+ = render partial: "search/results/empty", locals: { message: "We couldn't find any matching results" }
%ul.bordered-list
= render partial: "search/results/#{@scope.singularize}", collection: @objects
diff --git a/app/views/search/_project_results.html.haml b/app/views/search/_project_results.html.haml
index 9b2d485fdce..dd63d5d04cb 100644
--- a/app/views/search/_project_results.html.haml
+++ b/app/views/search/_project_results.html.haml
@@ -29,7 +29,7 @@
.col-sm-9
.search_results
- if @search_results.empty?
- = render partial: "search/results/empty", locals: { message: "We couldn't find any matchind results" }
+ = render partial: "search/results/empty", locals: { message: "We couldn't find any matching results" }
%ul.bordered-list
= render partial: "search/results/#{@scope.singularize}", collection: @objects
diff --git a/app/views/search/results/_merge_request.html.haml b/app/views/search/results/_merge_request.html.haml
index de2a79970c1..96a2e722ba3 100644
--- a/app/views/search/results/_merge_request.html.haml
+++ b/app/views/search/results/_merge_request.html.haml
@@ -1,14 +1,12 @@
%li
- merge request:
- = link_to [merge_request.target_project, merge_request] do
- %span ##{merge_request.iid}
- %strong.term
- = truncate merge_request.title, length: 50
- - if merge_request.for_fork?
- %span.light (#{merge_request.source_project.name_with_namespace}:#{merge_request.source_branch} &rarr; #{merge_request.target_project.name_with_namespace}:#{merge_request.target_branch})
- - else
- %span.light (#{merge_request.source_branch} &rarr; #{merge_request.target_branch})
- - if merge_request.merged?
- %span.label.label-primary Merged
- - elsif merge_request.closed?
- %span.label.label-danger Closed
+ %h4
+ = link_to [merge_request.target_project, merge_request] do
+ %span.term.str-truncated= merge_request.title
+ .pull-right ##{merge_request.iid}
+ %span.light
+ #{merge_request.project.name_with_namespace}
+ .pull-right
+ - if merge_request.merged?
+ %span.label.label-primary Merged
+ - elsif merge_request.closed?
+ %span.label.label-danger Closed
diff --git a/app/views/search/show.html.haml b/app/views/search/show.html.haml
index 3b6f10d4d9c..8d1614bfbd4 100644
--- a/app/views/search/show.html.haml
+++ b/app/views/search/show.html.haml
@@ -13,7 +13,7 @@
= render 'filter', f: f
= hidden_field_tag :project_id, params[:project_id]
= hidden_field_tag :group_id, params[:group_id]
- = hidden_field_tag :search_code, params[:search_code]
+ = hidden_field_tag :scope, params[:scope]
.results.prepend-top-10
- if params[:search].present?
diff --git a/features/search.feature b/features/search.feature
index b174d973122..54708c17575 100644
--- a/features/search.feature
+++ b/features/search.feature
@@ -24,6 +24,23 @@ Feature: Search
And I should not see "Bar" link
Scenario: I should see project code I am looking for
- When I search for "rspec"
- And I click project "Shop" link
+ When I click project "Shop" link
+ And I search for "rspec"
Then I should see code results for project "Shop"
+
+ Scenario: I should see project issues
+ And project has issues
+ When I click project "Shop" link
+ And I search for "Foo"
+ And I click "Issues" link
+ Then I should see "Foo" link
+ And I should not see "Bar" link
+
+ Scenario: I should see project merge requests
+ And project has merge requests
+ When I click project "Shop" link
+ And I search for "Foo"
+ And I click "Merge requests" link
+ Then I should see "Foo" link
+ And I should not see "Bar" link
+
diff --git a/features/steps/project/search_code.rb b/features/steps/project/search_code.rb
index affa7d3b43b..55218b6e745 100644
--- a/features/steps/project/search_code.rb
+++ b/features/steps/project/search_code.rb
@@ -6,7 +6,6 @@ class ProjectSearchCode < Spinach::FeatureSteps
step 'I search for term "coffee"' do
fill_in "search", with: "coffee"
click_button "Go"
- click_link 'Repository Code'
end
step 'I should see files from repository containing "coffee"' do
@@ -15,6 +14,6 @@ class ProjectSearchCode < Spinach::FeatureSteps
end
step 'I should see empty result' do
- page.should have_content "We couldn't find any matching code"
+ page.should have_content "We couldn't find any matching"
end
end