Feature #41202 » change-csv-export-default-encoding.patch
app/helpers/application_helper.rb | ||
---|---|---|
1824 | 1824 |
def export_csv_encoding_select_tag |
1825 | 1825 |
return if l(:general_csv_encoding).casecmp('UTF-8') == 0 |
1826 | 1826 | |
1827 |
options = [l(:general_csv_encoding), 'UTF-8']
|
|
1827 |
options = ['UTF-8', l(:general_csv_encoding)]
|
|
1828 | 1828 |
content_tag(:p) do |
1829 | 1829 |
concat( |
1830 | 1830 |
content_tag(:label) do |
1831 |
concat l(:label_encoding) + ' '
|
|
1832 |
concat select_tag('encoding', options_for_select(options, l(:general_csv_encoding)))
|
|
1831 |
concat "#{l(:label_encoding)} "
|
|
1832 |
concat select_tag('encoding', options_for_select(options, 'UTF-8'))
|
|
1833 | 1833 |
end |
1834 | 1834 |
) |
1835 | 1835 |
end |
test/helpers/application_helper_test.rb | ||
---|---|---|
2275 | 2275 | |
2276 | 2276 |
def test_export_csv_encoding_select_tag_should_have_two_option_when_general_csv_encoding_is_not_UTF8 |
2277 | 2277 |
with_locale 'en' do |
2278 |
assert_not_equal l(:general_csv_encoding), 'UTF-8'
|
|
2278 |
assert_equal l(:general_csv_encoding), 'ISO-8859-1'
|
|
2279 | 2279 |
result = export_csv_encoding_select_tag |
2280 |
assert_select_in result, |
|
2281 |
"option[selected='selected'][value=#{l(:general_csv_encoding)}]", |
|
2282 |
:text => l(:general_csv_encoding) |
|
2283 |
assert_select_in result, "option[value='UTF-8']", :text => 'UTF-8' |
|
2280 |
assert_select_in result, "option[selected='selected'][value='UTF-8']", :text => 'UTF-8' |
|
2281 |
assert_select_in result, "option[value='ISO-8859-1']", :text => 'ISO-8859-1' |
|
2284 | 2282 |
end |
2285 | 2283 |
end |
2286 | 2284 |
- « Previous
- 1
- 2
- Next »