]> source.dussan.org Git - redmine.git/commitdiff
Merged r18005 from trunk to 4.0-stable (#30923).
authorGo MAEDA <maeda@farend.jp>
Mon, 25 Mar 2019 03:48:44 +0000 (03:48 +0000)
committerGo MAEDA <maeda@farend.jp>
Mon, 25 Mar 2019 03:48:44 +0000 (03:48 +0000)
git-svn-id: http://svn.redmine.org/redmine/branches/4.0-stable@18006 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/views/layouts/base.html.erb
test/functional/projects_controller_test.rb

index 3d939b20dfe3c49a05c638dc16cfe5c4b003d4ef..48ba5621c57cc1308aa266d27e0a120507bf131f 100644 (file)
@@ -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 %>
index 03a33d58482700860e2d6158ff2cc8203b274001..35fcc532ab86611ab103baafceec21d586ec1ffe 100644 (file)
@@ -1030,4 +1030,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