diff options
author | Go MAEDA <maeda@farend.jp> | 2019-03-25 03:50:16 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2019-03-25 03:50:16 +0000 |
commit | e7cbfb012be16ef4b81bbc0c1166e77fa5aa6cd9 (patch) | |
tree | 0d031cd9c005ef6ad76a0977fc49c4eab1c1ad0b | |
parent | 1e02fa43e3358106947a94cd4499bf8507e09360 (diff) | |
download | redmine-e7cbfb012be16ef4b81bbc0c1166e77fa5aa6cd9.tar.gz redmine-e7cbfb012be16ef4b81bbc0c1166e77fa5aa6cd9.zip |
Merged r18005 from trunk to 3.4-stable (#30923).
git-svn-id: http://svn.redmine.org/redmine/branches/3.4-stable@18007 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/views/layouts/base.html.erb | 2 | ||||
-rw-r--r-- | test/functional/projects_controller_test.rb | 31 |
2 files changed, 32 insertions, 1 deletions
diff --git a/app/views/layouts/base.html.erb b/app/views/layouts/base.html.erb index 3d939b20d..48ba5621c 100644 --- a/app/views/layouts/base.html.erb +++ b/app/views/layouts/base.html.erb @@ -78,7 +78,7 @@ <%= hidden_field_tag 'scope', default_search_project_scope, :id => nil %> <%= hidden_field_tag(controller.default_search_scope, 1, :id => nil) if controller.default_search_scope %> <label for='q'> - <%= link_to l(:label_search), {:controller => 'search', :action => 'index', :id => @project}, :accesskey => accesskey(:search) %>: + <%= link_to l(:label_search), {:controller => 'search', :action => 'index', :id => @project, :scope => default_search_project_scope}, :accesskey => accesskey(:search) %>: </label> <%= text_field_tag 'q', @question, :size => 20, :class => 'small', :accesskey => accesskey(:quick_search) %> <% end %> diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb index 20dfaf474..75752c74b 100644 --- a/test/functional/projects_controller_test.rb +++ b/test/functional/projects_controller_test.rb @@ -1002,4 +1002,35 @@ class ProjectsControllerTest < Redmine::ControllerTest } assert_select 'body.project-ecookbook' end + + def test_default_search_scope_in_global_page + get :index + + assert_select 'div#quick-search form' do + assert_select 'input[name=scope][type=hidden]' + assert_select 'a[href=?]', '/search' + end + end + + def test_default_search_scope_for_project_without_subprojects + get :show, :params => { + :id => 4, + } + + assert_select 'div#quick-search form' do + assert_select 'input[name=scope][type=hidden]' + assert_select 'a[href=?]', '/projects/subproject2/search' + end + end + + def test_default_search_scope_for_project_with_subprojects + get :show, :params => { + :id => 1, + } + + assert_select 'div#quick-search form' do + assert_select 'input[name=scope][type=hidden][value=subprojects]' + assert_select 'a[href=?]', '/projects/ecookbook/search?scope=subprojects' + end + end end |