Save search options when switch between filter
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
c3ad51a0e4
commit
13f6dc1a94
|
@ -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 @@
|
||||||
%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 @@
|
||||||
%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 @@
|
||||||
.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 @@
|
||||||
.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
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
%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} → #{merge_request.target_project.name_with_namespace}:#{merge_request.target_branch})
|
.pull-right
|
||||||
- else
|
|
||||||
%span.light (#{merge_request.source_branch} → #{merge_request.target_branch})
|
|
||||||
- if merge_request.merged?
|
- if merge_request.merged?
|
||||||
%span.label.label-primary Merged
|
%span.label.label-primary Merged
|
||||||
- elsif merge_request.closed?
|
- elsif merge_request.closed?
|
||||||
|
|
|
@ -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
|
||||||
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
|
||||||
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
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue