From 3c0c0a767777b54e20a607c44037ffa20b92d316 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Wed, 3 Mar 2010 03:37:40 +0000 Subject: [PATCH] Allow multiple selected projects in #project_tree_options_for_select git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3525 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/application_helper.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e2887226a..593b5a4cc 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -205,7 +205,12 @@ module ApplicationHelper s = '' project_tree(projects) do |project, level| name_prefix = (level > 0 ? (' ' * 2 * level + '» ') : '') - tag_options = {:value => project.id, :selected => ((project == options[:selected]) ? 'selected' : nil)} + tag_options = {:value => project.id} + if project == options[:selected] || (options[:selected].respond_to?(:include?) && options[:selected].include?(project)) + tag_options[:selected] = 'selected' + else + tag_options[:selected] = nil + end tag_options.merge!(yield(project)) if block_given? s << content_tag('option', name_prefix + h(project), tag_options) end