1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Revert "I18n: use I18n for select helpers' prompt text"

Broke CI.

[#2252 state:open]

This reverts commit adedf72821.
This commit is contained in:
Jeremy Kemper 2009-08-26 12:12:40 -07:00
parent d672a14ee7
commit a7ca5595a2
3 changed files with 1 additions and 28 deletions

View file

@ -571,8 +571,7 @@ module ActionView
option_tags = "<option value=\"\">#{options[:include_blank] if options[:include_blank].kind_of?(String)}</option>\n" + option_tags
end
if value.blank? && options[:prompt]
prompt = options[:prompt].kind_of?(String) ? options[:prompt] : I18n.translate('support.select.prompt', :default => 'Please select')
"<option value=\"\">#{prompt}</option>\n" + option_tags
("<option value=\"\">#{options[:prompt].kind_of?(String) ? options[:prompt] : 'Please select'}</option>\n") + option_tags
else
option_tags
end

View file

@ -108,7 +108,3 @@
# The variable :count is also available
body: "There were problems with the following fields:"
support:
select:
# default value for :prompt => true in FormOptionsHelper
prompt: "Please select"

View file

@ -1,22 +0,0 @@
require 'abstract_unit'
class FormOptionsHelperI18nTests < ActionView::TestCase
tests ActionView::Helpers::FormOptionsHelper
def setup
@prompt_message = 'Select!'
I18n.backend.store_translations :en, :support => { :select => { :prompt => @prompt_message} }
end
def test_select_with_prompt_true_translates_prompt_message
I18n.expects(:translate).with('support.select.prompt', { :default => 'Please select' })
select 'post', 'category', [], :prompt => true
end
def test_select_with_translated_prompt
assert_dom_equal(
%Q(<select id="post_category" name="post[category]"><option value="">#{@prompt_message}</option>\n</select>),
select('post', 'category', [], :prompt => true)
)
end
end