Feature #41202 » change-csv-export-default-encoding.patch
| app/helpers/application_helper.rb | ||
|---|---|---|
|
def export_csv_encoding_select_tag
|
||
|
return if l(:general_csv_encoding).casecmp('UTF-8') == 0
|
||
|
options = [l(:general_csv_encoding), 'UTF-8']
|
||
|
options = ['UTF-8', l(:general_csv_encoding)]
|
||
|
content_tag(:p) do
|
||
|
concat(
|
||
|
content_tag(:label) do
|
||
|
concat l(:label_encoding) + ' '
|
||
|
concat select_tag('encoding', options_for_select(options, l(:general_csv_encoding)))
|
||
|
concat "#{l(:label_encoding)} "
|
||
|
concat select_tag('encoding', options_for_select(options, 'UTF-8'))
|
||
|
end
|
||
|
)
|
||
|
end
|
||
| test/helpers/application_helper_test.rb | ||
|---|---|---|
|
def test_export_csv_encoding_select_tag_should_have_two_option_when_general_csv_encoding_is_not_UTF8
|
||
|
with_locale 'en' do
|
||
|
assert_not_equal l(:general_csv_encoding), 'UTF-8'
|
||
|
assert_equal l(:general_csv_encoding), 'ISO-8859-1'
|
||
|
result = export_csv_encoding_select_tag
|
||
|
assert_select_in result,
|
||
|
"option[selected='selected'][value=#{l(:general_csv_encoding)}]",
|
||
|
:text => l(:general_csv_encoding)
|
||
|
assert_select_in result, "option[value='UTF-8']", :text => 'UTF-8'
|
||
|
assert_select_in result, "option[selected='selected'][value='UTF-8']", :text => 'UTF-8'
|
||
|
assert_select_in result, "option[value='ISO-8859-1']", :text => 'ISO-8859-1'
|
||
|
end
|
||
|
end
|
||
- « Previous
- 1
- 2
- Next »