Commit 13f6dc1a authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Save search options when switch between filter

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent c3ad51a0
......@@ -101,9 +101,6 @@ module SearchHelper
}
options = exist_opts.merge(options)
path = request.path
path << "?#{options.to_param}"
path
search_path(options)
end
end
......@@ -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
......@@ -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
......
......@@ -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
......
%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
......@@ -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?
......
......@@ -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
......@@ -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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment