Fixed that root projects are escaped twice in the project drop down (#11217).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9894 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-06-26 16:54:30 +00:00
parent 0ecab46229
commit 7f6ac407ef
2 changed files with 11 additions and 1 deletions

View File

@ -253,7 +253,7 @@ module ApplicationHelper
def project_tree_options_for_select(projects, options = {}) def project_tree_options_for_select(projects, options = {})
s = '' s = ''
project_tree(projects) do |project, level| project_tree(projects) do |project, level|
name_prefix = (level > 0 ? (' ' * 2 * level + '» ').html_safe : '') name_prefix = (level > 0 ? (' ' * 2 * level + '» ') : '').html_safe
tag_options = {:value => project.id} tag_options = {:value => project.id}
if project == options[:selected] || (options[:selected].respond_to?(:include?) && options[:selected].include?(project)) if project == options[:selected] || (options[:selected].respond_to?(:include?) && options[:selected].include?(project))
tag_options[:selected] = 'selected' tag_options[:selected] = 'selected'

View File

@ -96,6 +96,16 @@ class WelcomeControllerTest < ActionController::TestCase
assert @controller.respond_to?(:call_hook) assert @controller.respond_to?(:call_hook)
end end
def test_project_jump_box_should_escape_names_once
Project.find(1).update_attribute :name, 'Foo & Bar'
@request.session[:user_id] = 2
get :index
assert_select "#header select" do
assert_select "option", :text => 'Foo &amp; Bar'
end
end
context "test_api_offset_and_limit" do context "test_api_offset_and_limit" do
context "without params" do context "without params" do
should "return 0, 25" do should "return 0, 25" do