diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-03-19 20:31:02 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-03-19 20:31:02 +0000 |
commit | dfb81dd89c504daec22a26f0020b8c376609304f (patch) | |
tree | 5b80d6fab478c478938760c04e7da46c6f2255d5 | |
parent | 59e3802c7476591cfa1d50c2008ecf9e67e75828 (diff) | |
download | redmine-dfb81dd89c504daec22a26f0020b8c376609304f.tar.gz redmine-dfb81dd89c504daec22a26f0020b8c376609304f.zip |
added back "subproject" filter on issue list
git-svn-id: http://redmine.rubyforge.org/svn/trunk@350 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/models/query.rb | 19 | ||||
-rw-r--r-- | app/views/queries/_filters.rhtml | 2 | ||||
-rw-r--r-- | lang/de.yml | 2 | ||||
-rw-r--r-- | lang/en.yml | 2 | ||||
-rw-r--r-- | lang/es.yml | 2 | ||||
-rw-r--r-- | lang/fr.yml | 2 | ||||
-rw-r--r-- | lang/it.yml | 2 | ||||
-rw-r--r-- | lang/ja.yml | 2 |
8 files changed, 24 insertions, 9 deletions
diff --git a/app/models/query.rb b/app/models/query.rb index fbf48927a..fcfad6839 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -45,6 +45,7 @@ class Query < ActiveRecord::Base @@operators_by_filter_type = { :list => [ "=", "!" ], :list_status => [ "o", "=", "!", "c", "*" ], :list_optional => [ "=", "!", "!*", "*" ], + :list_one_or_more => [ "*", "=" ], :date => [ "<t+", ">t+", "t+", "t", ">t-", "<t-", "t-" ], :date_past => [ ">t-", "<t-", "t-", "t" ], :text => [ "~", "!~" ] } @@ -83,6 +84,9 @@ class Query < ActiveRecord::Base @available_filters["author_id"] = { :type => :list, :order => 5, :values => @project.users.collect{|s| [s.name, s.id.to_s] } } @available_filters["category_id"] = { :type => :list_optional, :order => 6, :values => @project.issue_categories.collect{|s| [s.name, s.id.to_s] } } @available_filters["fixed_version_id"] = { :type => :list_optional, :order => 7, :values => @project.versions.collect{|s| [s.name, s.id.to_s] } } + unless @project.children.empty? + @available_filters["subproject_id"] = { :type => :list_one_or_more, :order => 13, :values => @project.children.collect{|s| [s.name, s.id.to_s] } } + end # remove category filter if no category defined @available_filters.delete "category_id" if @available_filters["category_id"][:values].empty? end @@ -123,9 +127,20 @@ class Query < ActiveRecord::Base end def statement - sql = "1=1" - sql << " AND #{Issue.table_name}.project_id=%d" % project.id if project + sql = "1=1" + if has_filter?("subproject_id") + subproject_ids = [] + if operator_for("subproject_id") == "=" + subproject_ids = values_for("subproject_id").each(&:to_i) + else + subproject_ids = project.children.collect{|p| p.id} + end + sql << " AND #{Issue.table_name}.project_id IN (%d,%s)" % [project.id, subproject_ids.join(",")] if project + else + sql << " AND #{Issue.table_name}.project_id=%d" % project.id if project + end filters.each_key do |field| + next if field == "subproject_id" v = values_for field next unless v and !v.empty? sql = sql + " AND " unless sql.empty? diff --git a/app/views/queries/_filters.rhtml b/app/views/queries/_filters.rhtml index aa64dbb8f..0314e30b5 100644 --- a/app/views/queries/_filters.rhtml +++ b/app/views/queries/_filters.rhtml @@ -74,7 +74,7 @@ function toggle_multi_select(field) { <td valign="top"> <div id="div_values_<%= field %>"> <% case options[:type] - when :list, :list_optional, :list_status %> + when :list, :list_optional, :list_status, :list_one_or_more %> <select <%= "multiple=true" if query.values_for(field) and query.values_for(field).length > 1 %> name="values[<%= field %>][]" id="values_<%= field %>" class="select-small" style="vertical-align: top;"> <%= options_for_select options[:values], query.values_for(field) %> </select> diff --git a/lang/de.yml b/lang/de.yml index 3e679ed63..f11d37ac3 100644 --- a/lang/de.yml +++ b/lang/de.yml @@ -142,6 +142,7 @@ field_hide_mail: Mein email address verstecken field_comment: Anmerkung
field_url: URL
field_start_page: Hauptseite
+field_subproject: Vorprojekt von
setting_app_title: Applikation Titel
setting_app_subtitle: Applikation Untertitel
@@ -220,7 +221,6 @@ label_authentication: Authentisierung label_auth_source: Authentisierung Modus
label_auth_source_new: Neuer Authentisierung Modus
label_auth_source_plural: Authentisierung Modi
-label_subproject: Vorprojekt von
label_subproject_plural: Vorprojekte
label_min_max_length: Min - Max Länge
label_list: Liste
diff --git a/lang/en.yml b/lang/en.yml index b7a2e96fb..94e3b984b 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -142,6 +142,7 @@ field_hide_mail: Hide my email address field_comment: Comment
field_url: URL
field_start_page: Start page
+field_subproject: Subproject
setting_app_title: Application title
setting_app_subtitle: Application subtitle
@@ -220,7 +221,6 @@ label_authentication: Authentication label_auth_source: Authentication mode
label_auth_source_new: New authentication mode
label_auth_source_plural: Authentication modes
-label_subproject: Subproject
label_subproject_plural: Subprojects
label_min_max_length: Min - Max length
label_list: List
diff --git a/lang/es.yml b/lang/es.yml index 9640ab144..d9ebd1070 100644 --- a/lang/es.yml +++ b/lang/es.yml @@ -142,6 +142,7 @@ field_hide_mail: Ocultar mi email address field_comment: Comentario
field_url: URL
field_start_page: Página principal
+field_subproject: Proyecto secundario
setting_app_title: Título del aplicación
setting_app_subtitle: Subtítulo del aplicación
@@ -220,7 +221,6 @@ label_authentication: Autentificación label_auth_source: Modo de la autentificación
label_auth_source_new: Nuevo modo de la autentificación
label_auth_source_plural: Modos de la autentificación
-label_subproject: Proyecto secundario
label_subproject_plural: Proyectos secundarios
label_min_max_length: Longitud mín - máx
label_list: Lista
diff --git a/lang/fr.yml b/lang/fr.yml index 758406d7e..3ef3fbb1e 100644 --- a/lang/fr.yml +++ b/lang/fr.yml @@ -142,6 +142,7 @@ field_hide_mail: Cacher mon adresse mail field_comment: Commentaire
field_url: URL
field_start_page: Page de démarrage
+field_subproject: Sous-projet
setting_app_title: Titre de l'application
setting_app_subtitle: Sous-titre de l'application
@@ -220,7 +221,6 @@ label_authentication: Authentification label_auth_source: Mode d'authentification
label_auth_source_new: Nouveau mode d'authentification
label_auth_source_plural: Modes d'authentification
-label_subproject: Sous-projet
label_subproject_plural: Sous-projets
label_min_max_length: Longueurs mini - maxi
label_list: Liste
diff --git a/lang/it.yml b/lang/it.yml index c7a4bb92f..67372c9d5 100644 --- a/lang/it.yml +++ b/lang/it.yml @@ -142,6 +142,7 @@ field_hide_mail: Nascondi il mio indirizzo di e-mail field_comment: Commento
field_url: URL
field_start_page: Pagina principale
+field_subproject: Sottoprogetto
setting_app_title: Titolo applicazione
setting_app_subtitle: Sottotitolo applicazione
@@ -220,7 +221,6 @@ label_authentication: Autenticazione label_auth_source: Modalità di autenticazione
label_auth_source_new: Nuova modalità di autenticazione
label_auth_source_plural: Modalità di autenticazione
-label_subproject: Sottoprogetto
label_subproject_plural: Sottoprogetti
label_min_max_length: Lunghezza minima - massima
label_list: Elenco
diff --git a/lang/ja.yml b/lang/ja.yml index 06d0d4651..dfc3c37ec 100644 --- a/lang/ja.yml +++ b/lang/ja.yml @@ -143,6 +143,7 @@ field_hide_mail: Emailアドレスを隠す field_comment: コメント
field_url: URL
field_start_page: メインページ
+field_subproject: サブプロジェクト
setting_app_title: アプリケーションのタイトル
setting_app_subtitle: アプリケーションのサブタイトル
@@ -221,7 +222,6 @@ label_authentication: 認証 label_auth_source: 認証モード
label_auth_source_new: 新しい認証モード
label_auth_source_plural: 認証モード
-label_subproject: サブプロジェクト
label_subproject_plural: サブプロジェクト
label_min_max_length: 最小値 - 最大値の長さ
label_list: リストから選択
|