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 ...@@ -101,9 +101,6 @@ module SearchHelper
} }
options = exist_opts.merge(options) options = exist_opts.merge(options)
search_path(options)
path = request.path
path << "?#{options.to_param}"
path
end end
end end
...@@ -9,11 +9,11 @@ ...@@ -9,11 +9,11 @@
%b.caret %b.caret
%ul.dropdown-menu %ul.dropdown-menu
%li %li
= link_to search_path(group_id: nil, search: params[:search]) do = link_to search_filter_path(group_id: nil) do
Any Any
- current_user.authorized_groups.sort_by(&:name).each do |group| - current_user.authorized_groups.sort_by(&:name).each do |group|
%li %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 = group.name
.dropdown.inline.prepend-left-10.project-filter .dropdown.inline.prepend-left-10.project-filter
...@@ -27,9 +27,9 @@ ...@@ -27,9 +27,9 @@
%b.caret %b.caret
%ul.dropdown-menu %ul.dropdown-menu
%li %li
= link_to search_path(project_id: nil, search: params[:search]) do = link_to search_filter_path(project_id: nil) do
Any Any
- current_user.authorized_projects.sort_by(&:name_with_namespace).each do |project| - current_user.authorized_projects.sort_by(&:name_with_namespace).each do |project|
%li %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 = project.name_with_namespace
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
.col-sm-9 .col-sm-9
.search_results .search_results
- if @search_results.empty? - 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 %ul.bordered-list
= render partial: "search/results/#{@scope.singularize}", collection: @objects = render partial: "search/results/#{@scope.singularize}", collection: @objects
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
.col-sm-9 .col-sm-9
.search_results .search_results
- if @search_results.empty? - 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 %ul.bordered-list
= render partial: "search/results/#{@scope.singularize}", collection: @objects = render partial: "search/results/#{@scope.singularize}", collection: @objects
......
%li %li
merge request: %h4
= link_to [merge_request.target_project, merge_request] do = link_to [merge_request.target_project, merge_request] do
%span ##{merge_request.iid} %span.term.str-truncated= merge_request.title
%strong.term .pull-right ##{merge_request.iid}
= truncate merge_request.title, length: 50 %span.light
- if merge_request.for_fork? #{merge_request.project.name_with_namespace}
%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}) .pull-right
- else - if merge_request.merged?
%span.light (#{merge_request.source_branch} &rarr; #{merge_request.target_branch}) %span.label.label-primary Merged
- if merge_request.merged? - elsif merge_request.closed?
%span.label.label-primary Merged %span.label.label-danger Closed
- elsif merge_request.closed?
%span.label.label-danger Closed
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
= render 'filter', f: f = render 'filter', f: f
= hidden_field_tag :project_id, params[:project_id] = hidden_field_tag :project_id, params[:project_id]
= hidden_field_tag :group_id, params[:group_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 .results.prepend-top-10
- if params[:search].present? - if params[:search].present?
......
...@@ -24,6 +24,23 @@ Feature: Search ...@@ -24,6 +24,23 @@ Feature: Search
And I should not see "Bar" link And I should not see "Bar" link
Scenario: I should see project code I am looking for Scenario: I should see project code I am looking for
When I search for "rspec" When I click project "Shop" link
And I click project "Shop" link And I search for "rspec"
Then I should see code results for project "Shop" 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 ...@@ -6,7 +6,6 @@ class ProjectSearchCode < Spinach::FeatureSteps
step 'I search for term "coffee"' do step 'I search for term "coffee"' do
fill_in "search", with: "coffee" fill_in "search", with: "coffee"
click_button "Go" click_button "Go"
click_link 'Repository Code'
end end
step 'I should see files from repository containing "coffee"' do step 'I should see files from repository containing "coffee"' do
...@@ -15,6 +14,6 @@ class ProjectSearchCode < Spinach::FeatureSteps ...@@ -15,6 +14,6 @@ class ProjectSearchCode < Spinach::FeatureSteps
end end
step 'I should see empty result' do 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
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