Commit dfb81dd8 authored by Jean-Philippe Lang's avatar Jean-Philippe Lang

added back "subproject" filter on issue list

git-svn-id: http://redmine.rubyforge.org/svn/trunk@350 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 59e3802c
......@@ -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?
......
......@@ -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>
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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: リストから選択
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment