]> source.dussan.org Git - redmine.git/commitdiff
Ability to search a project and its subprojects (#1264).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 20 May 2008 20:31:04 +0000 (20:31 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 20 May 2008 20:31:04 +0000 (20:31 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1439 e93f8b46-1217-0410-a6f0-8f06a7374b81

29 files changed:
app/controllers/search_controller.rb
app/helpers/search_helper.rb
lang/bg.yml
lang/cs.yml
lang/da.yml
lang/de.yml
lang/en.yml
lang/es.yml
lang/fi.yml
lang/fr.yml
lang/he.yml
lang/it.yml
lang/ja.yml
lang/ko.yml
lang/lt.yml
lang/nl.yml
lang/no.yml
lang/pl.yml
lang/pt-br.yml
lang/pt.yml
lang/ro.yml
lang/ru.yml
lang/sr.yml
lang/sv.yml
lang/th.yml
lang/uk.yml
lang/zh-tw.yml
lang/zh.yml
test/functional/search_controller_test.rb

index d93c638084563bd4e0ce31364a63ad66f94dda32..d4ef01bf80a4c4e1cb389a15f31d747ee758ec3d 100644 (file)
@@ -30,11 +30,13 @@ class SearchController < ApplicationController
     @titles_only = !params[:titles_only].nil?
     
     projects_to_search =
-      case params[:projects]
+      case params[:scope]
       when 'all'
         nil
       when 'my_projects'
         User.current.memberships.collect(&:project)
+      when 'subprojects'
+        @project ? ([ @project ] + @project.active_children) : nil
       else
         @project
       end
index 6b5a2cede90a97e2f1a353a38a8e87c95e8f25a6..d6a2fb949696141db70c93325bc02e40d868e26f 100644 (file)
@@ -39,7 +39,8 @@ module SearchHelper
   def project_select_tag
     options = [[l(:label_project_all), 'all']]
     options << [l(:label_my_projects), 'my_projects'] unless User.current.memberships.empty?
+    options << [l(:label_and_its_subprojects, @project.name), 'subprojects'] unless @project.nil? || @project.active_children.empty?
     options << [@project.name, ''] unless @project.nil?
-    select_tag('projects', options_for_select(options, params[:projects].to_s)) if options.size > 1
+    select_tag('scope', options_for_select(options, params[:scope].to_s)) if options.size > 1
   end
 end
index b341d989fee16cc940baab622977c30b9b722b9b..224177d94e3f71902922d3fd26d079f3404c447c 100644 (file)
@@ -618,3 +618,4 @@ setting_default_projects_public: Новите проекти са публичн
 error_scm_annotate: "Обектът не съществува или не може да бъде анотиран."
 label_planning: Планиране
 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
+label_and_its_subprojects: %s and its subprojects
index 250c602c2f2bf80ca127e724c5f051f370ef17e5..2126553fc6cf5159ed4c2a0958c106d5facccfa2 100644 (file)
@@ -623,3 +623,4 @@ enumeration_activities: Aktivity (sledování času)
 error_scm_annotate: "Položka neexistuje nebo nemůže být komentována."
 label_planning: Plánování
 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
+label_and_its_subprojects: %s and its subprojects
index ff2ed982df6d73282fc76824b854e641c90a0b1f..3b5ca07d3ff9d5ad68e5486104422a79a684abf5 100644 (file)
@@ -620,3 +620,4 @@ setting_default_projects_public: Nye projekter er offentlige som default
 error_scm_annotate: "The entry does not exist or can not be annotated."
 label_planning: Planlægning
 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
+label_and_its_subprojects: %s and its subprojects
index 77184cf88a89b5053a413a0ac530dda4cb26eaf1..273bad27741f21746476a336b4e10e503d5a1b9d 100644 (file)
@@ -619,3 +619,4 @@ enumeration_issue_priorities: Ticket-Prioritäten
 enumeration_doc_categories: Dokumentenkategorien
 enumeration_activities: Aktivitäten (Zeiterfassung)
 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
+label_and_its_subprojects: %s and its subprojects
index e39aec301488d87c9ed5858aa8d714b84dbc86c4..892a63a1b1c006ab565341d996809ff1369bd506 100644 (file)
@@ -291,6 +291,7 @@ label_auth_source: Authentication mode
 label_auth_source_new: New authentication mode
 label_auth_source_plural: Authentication modes
 label_subproject_plural: Subprojects
+label_and_its_subprojects: %s and its subprojects
 label_min_max_length: Min - Max length
 label_list: List
 label_date: Date
index c6eef021a42ce41e1a4eefe7f86c6fdfc015480f..26009d716b9e5c24ebe1a19a49a555ac49b13175 100644 (file)
@@ -621,3 +621,4 @@ setting_default_projects_public: Los proyectos nuevos son públicos por defecto
 error_scm_annotate: "No existe la entrada o no ha podido ser anotada"
 label_planning: Planificación
 text_subprojects_destroy_warning: 'Sus subprojectos: %s también se eliminarán' 
+label_and_its_subprojects: %s and its subprojects
index 1a614a16cce84aa99df9c9597b37bf758d737030..908ef1283381f0a8619ab3a59f04ee6531d13271 100644 (file)
@@ -618,3 +618,4 @@ label_overall_activity: Kokonaishistoria
 error_scm_annotate: "Merkintää ei ole tai siihen ei voi lisätä selityksiä."
 label_planning: Suunnittelu
 text_subprojects_destroy_warning: 'Tämän alaprojekti(t): %s tullaan myös poistamaan.'
+label_and_its_subprojects: %s and its subprojects
index cbdda4f3d0bcc372f43360234d0869f9347cc73f..8827edd5e06651c44ad327c2f3027707aa668ea8 100644 (file)
@@ -291,6 +291,7 @@ label_auth_source: Mode d'authentification
 label_auth_source_new: Nouveau mode d'authentification
 label_auth_source_plural: Modes d'authentification
 label_subproject_plural: Sous-projets
+label_and_its_subprojects: %s et ses sous-projets
 label_min_max_length: Longueurs mini - maxi
 label_list: Liste
 label_date: Date
index a611c8c390eac0cdfd4e62ca561bbe18ef5a7a07..71bc5e5b3a6547ea533243340d58c524dcb2c469 100644 (file)
@@ -618,3 +618,4 @@ setting_default_projects_public: פרויקטים חדשים הינם פומבי
 error_scm_annotate: "הכניסה לא קיימת או שלא ניתן לתאר אותה."
 label_planning: תכנון
 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
+label_and_its_subprojects: %s and its subprojects
index 3d1dea09e0fcb46c8f710d270e0a32d3069bfd45..1771e1bdaa248a6a63516c5f5432705ef7d8fc25 100644 (file)
@@ -618,3 +618,4 @@ setting_default_projects_public: New projects are public by default
 error_scm_annotate: "The entry does not exist or can not be annotated."
 label_planning: Planning
 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
+label_and_its_subprojects: %s and its subprojects
index 680d29836d3cbe4bec8b43a3be4d45661cce8030..84f27a2eb29a234ca49e8c76dedc3fb481f86b0f 100644 (file)
@@ -619,3 +619,4 @@ setting_default_projects_public: デフォルトで新しいプロジェクト
 error_scm_annotate: "エントリが存在しない、もしくはアノテートできません。"
 label_planning: 計画
 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
+label_and_its_subprojects: %s and its subprojects
index 4281f3881e501f509ae2b60aee515526b99453cd..ee94c4025b39a0d24f135bb92a213c4c9d0aa3ba 100644 (file)
@@ -618,3 +618,4 @@ setting_default_projects_public: New projects are public by default
 error_scm_annotate: "The entry does not exist or can not be annotated."
 label_planning: Planning
 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
+label_and_its_subprojects: %s and its subprojects
index df7cd960b199e7b8decfe8cf7e915b88ff05977d..a5883518603c6c15bd4f5142f62287f6a7972005 100644 (file)
@@ -619,3 +619,4 @@ setting_default_projects_public: New projects are public by default
 error_scm_annotate: "The entry does not exist or can not be annotated."
 label_planning: Planning
 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
+label_and_its_subprojects: %s and its subprojects
index e487a7a6d4c6f3afa1920aebe08eef65a2535a4f..01755137afabd1fc7b265e732282d45c82103b2e 100644 (file)
@@ -619,3 +619,4 @@ setting_default_projects_public: New projects are public by default
 error_scm_annotate: "The entry does not exist or can not be annotated."
 label_planning: Planning
 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
+label_and_its_subprojects: %s and its subprojects
index ccfa5c99f5f3d7ef639cfa3149b3426ab25ed0e0..388e51dd759471eba5165a50ee90b2e3f0d93a23 100644 (file)
@@ -619,3 +619,4 @@ default_activity_development: Utvikling
 enumeration_issue_priorities: Sakssprioriteringer
 enumeration_doc_categories: Dokument-kategorier
 enumeration_activities: Aktiviteter (tidssporing)
+label_and_its_subprojects: %s and its subprojects
index cf101811ac85bd14f5af03f294be90b72d71cea4..bc65b625322d775d2118d0d55da2ac4b443bef93 100644 (file)
@@ -618,3 +618,4 @@ setting_default_projects_public: Nowe projekty są domyślnie publiczne
 error_scm_annotate: "Wpis nie istnieje lub nie można do niego dodawać adnotacji."
 label_planning: Planning
 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
+label_and_its_subprojects: %s and its subprojects
index 9facd8d193f1b9e804bbb8c8ff77308232bacd8a..b1f8d2055ade8f58e3c1cc75bb15cf8fde214664 100644 (file)
@@ -618,3 +618,4 @@ setting_default_projects_public: New projects are public by default
 error_scm_annotate: "The entry does not exist or can not be annotated."\r
 label_planning: Planning\r
 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'\r
+label_and_its_subprojects: %s and its subprojects\r
index 6f51c8ed2f3d048748ec0fa4a90e26d306b00713..9d0586775ef0bd8d86698be3153ffd66fb76f437 100644 (file)
@@ -618,3 +618,4 @@ setting_default_projects_public: New projects are public by default
 error_scm_annotate: "The entry does not exist or can not be annotated."
 label_planning: Planning
 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
+label_and_its_subprojects: %s and its subprojects
index 59edfeb706ec76470ed7bcaaddf8b29e4e021c68..01127f5c517ef63498c1215bc7e555e2a37b436d 100644 (file)
@@ -618,3 +618,4 @@ setting_default_projects_public: New projects are public by default
 error_scm_annotate: "The entry does not exist or can not be annotated."
 label_planning: Planning
 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
+label_and_its_subprojects: %s and its subprojects
index f690098475128496220a01dbfa1220757edae487..4f0a4bb7b6350a187f572e853fa6c735985d5b05 100644 (file)
@@ -622,3 +622,4 @@ setting_default_projects_public: Новые проекты являются пу
 error_scm_annotate: "Данные отсутствуют или не могут быть подписаны."
 label_planning: Планирование
 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
+label_and_its_subprojects: %s and its subprojects
index d9869c362fece4a02529825bbe585846bc2301be..263bd11872d21fb13211a235480d9a545183c459 100644 (file)
@@ -619,3 +619,4 @@ setting_default_projects_public: New projects are public by default
 error_scm_annotate: "The entry does not exist or can not be annotated."
 label_planning: Planning
 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
+label_and_its_subprojects: %s and its subprojects
index c0f691230408e4879f7adbd92c3c12f308337086..5b0c57acf36b729820773576d00f5ad809eb4688 100644 (file)
@@ -619,3 +619,4 @@ setting_default_projects_public: New projects are public by default
 error_scm_annotate: "The entry does not exist or can not be annotated."
 label_planning: Planning
 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
+label_and_its_subprojects: %s and its subprojects
index 2c506c664fde2eb50bae229b59cdebe2346b1ecd..643ee01c665d005b031d896aac834351259a8334 100644 (file)
@@ -621,3 +621,4 @@ default_activity_development: พัฒนา
 enumeration_issue_priorities: ความสำคัญของปัญหา
 enumeration_doc_categories: ประเภทเอกสาร
 enumeration_activities: กิจกรรม (ใช้ในการติดตามเวลา)
+label_and_its_subprojects: %s and its subprojects
index a52a056038472098308004fb4fcd3286a7ec75e5..e61fc5b383960dc058ed4537c37c7f77110d5abc 100644 (file)
@@ -620,3 +620,4 @@ setting_default_projects_public: New projects are public by default
 error_scm_annotate: "The entry does not exist or can not be annotated."
 label_planning: Planning
 text_subprojects_destroy_warning: 'Its subproject(s): %s will be also deleted.'
+label_and_its_subprojects: %s and its subprojects
index d91c9708db26cee5b3ee9221827ea8d45f63a4de..b52446917de0da55235d3ef55b9afa4dd432f4e6 100644 (file)
@@ -619,3 +619,4 @@ default_activity_development: 開發
 enumeration_issue_priorities: 項目優先權
 enumeration_doc_categories: 文件分類
 enumeration_activities: 活動 (時間追蹤)
+label_and_its_subprojects: %s and its subprojects
index c8b809764490a780a1cfa931020d57a477306388..808dd1b396b61c6391256c1c3ad2ace67e6887ad 100644 (file)
@@ -619,3 +619,4 @@ default_activity_development: 开发
 enumeration_issue_priorities: 问题优先级
 enumeration_doc_categories: 文档类别
 enumeration_activities: 活动(时间跟踪)
+label_and_its_subprojects: %s and its subprojects
index b02f0779365fec0aaafefacf55016e55cf64ea29..1c505620bee390ad4f09dfdef085354c2084d9c2 100644 (file)
@@ -37,6 +37,14 @@ class SearchControllerTest < Test::Unit::TestCase
     assert assigns(:results).include?(Changeset.find(101))
   end
   
+  def test_search_project_and_subprojects
+    get :index, :id => 1, :q => 'recipe subproject', :scope => 'subprojects', :submit => 'Search'
+    assert_response :success
+    assert_template 'index'
+    assert assigns(:results).include?(Issue.find(1))
+    assert assigns(:results).include?(Issue.find(5))
+  end
+
   def test_search_without_searchable_custom_fields
     CustomField.update_all "searchable = #{ActiveRecord::Base.connection.quoted_false}"