File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
lib/active_admin/globalize3 Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -6,17 +6,18 @@ module FormBuilderExtension
6
6
def translated_inputs ( name = "Translations" , options = { } , &block )
7
7
options . symbolize_keys!
8
8
switch_locale = options . fetch ( :switch_locale , false )
9
+ auto_sort = options . fetch ( :auto_sort , true )
9
10
form_buffers . last << template . content_tag ( :div , class : "activeadmin-translations" ) do
10
11
template . content_tag ( :ul , class : "available-locales" ) do
11
- I18n . available_locales . map do |locale |
12
+ ( auto_sort ? I18n . available_locales . sort : I18n . available_locales ) . map do |locale |
12
13
template . content_tag ( :li ) do
13
14
I18n . with_locale ( switch_locale ? locale : I18n . locale ) do
14
15
template . content_tag ( :a , I18n . t ( :"active_admin.globalize3.language.#{ locale } " ) , href :".locale-#{ locale } " )
15
16
end
16
17
end
17
18
end . join . html_safe
18
19
end <<
19
- I18n . available_locales . sort . map do |locale |
20
+ ( auto_sort ? I18n . available_locales . sort : I18n . available_locales ) . map do |locale |
20
21
translation = object . translations . find { |t | t . locale . to_s == locale . to_s }
21
22
translation ||= object . translations . build ( locale : locale )
22
23
fields = proc do |form |
You can’t perform that action at this time.
0 commit comments