mirror of
https://github.com/meineerde/redmine.git
synced 2026-02-01 03:57:15 +00:00
Remove overrides that inserts a non-breaking space (nbsp) to empty option elements (#40210).
Patch by Go MAEDA (maeda). git-svn-id: https://svn.redmine.org/redmine/trunk@22701 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
759bececdd
commit
f59ac49dea
@ -34,20 +34,8 @@ end
|
||||
|
||||
ActionView::Base.field_error_proc = Proc.new{ |html_tag, instance| html_tag || ''.html_safe }
|
||||
|
||||
# HTML5: <option value=""></option> is invalid, use <option value=""> </option> instead
|
||||
module ActionView
|
||||
module Helpers
|
||||
module Tags
|
||||
SelectRenderer.prepend(Module.new do
|
||||
def add_options(option_tags, options, value = nil)
|
||||
if options.delete(:include_blank)
|
||||
options[:prompt] = ' '.html_safe
|
||||
end
|
||||
super
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
module FormHelper
|
||||
alias :date_field_without_max :date_field
|
||||
def date_field(object_name, method, options = {})
|
||||
@ -56,29 +44,11 @@ module ActionView
|
||||
end
|
||||
|
||||
module FormTagHelper
|
||||
alias :select_tag_without_non_empty_blank_option :select_tag
|
||||
def select_tag(name, option_tags = nil, options = {})
|
||||
if options.delete(:include_blank)
|
||||
options[:prompt] = ' '.html_safe
|
||||
end
|
||||
select_tag_without_non_empty_blank_option(name, option_tags, options)
|
||||
end
|
||||
|
||||
alias :date_field_tag_without_max :date_field_tag
|
||||
def date_field_tag(name, value = nil, options = {})
|
||||
date_field_tag_without_max(name, value, options.reverse_merge(max: '9999-12-31'))
|
||||
end
|
||||
end
|
||||
|
||||
module FormOptionsHelper
|
||||
alias :options_for_select_without_non_empty_blank_option :options_for_select
|
||||
def options_for_select(container, selected = nil)
|
||||
if container.is_a?(Array)
|
||||
container = container.map {|element| element.presence || [" ".html_safe, ""]}
|
||||
end
|
||||
options_for_select_without_non_empty_blank_option(container, selected)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -177,10 +177,6 @@ class BoardsControllerTest < Redmine::ControllerTest
|
||||
assert_select 'option[value=""]'
|
||||
assert_select 'option[value="1"]', :text => 'Help'
|
||||
end
|
||||
|
||||
# replaced by nokogiri, not easy to test in DOM assertions
|
||||
assert_not_include '<option value=""></option>', response.body
|
||||
assert_include '<option value=""> </option>', response.body
|
||||
end
|
||||
|
||||
def test_new_without_project_boards
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user