Skip to content

Commit 4444ecc

Browse files
author
Lukas Hodel
committed
Adds option to controll auto_sorting
1 parent 65e9de1 commit 4444ecc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/active_admin/globalize3/form_builder_extension.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ module FormBuilderExtension
66
def translated_inputs(name = "Translations", options = {}, &block)
77
options.symbolize_keys!
88
switch_locale = options.fetch(:switch_locale, false)
9+
auto_sort = options.fetch(:auto_sort, :false)
910
form_buffers.last << template.content_tag(:div, class: "activeadmin-translations") do
1011
template.content_tag(:ul, class: "available-locales") do
11-
I18n.available_locales.map do |locale|
12+
locales = auto_sort ? I18n.available_locales.sort : I18n.available_locales
13+
locales.map do |locale|
1214
template.content_tag(:li) do
1315
I18n.with_locale(switch_locale ? locale : I18n.locale) do
1416
template.content_tag(:a, I18n.t(:"active_admin.globalize3.language.#{locale}"), href:".locale-#{locale}")

0 commit comments

Comments
 (0)