Class: ActiveAdmin::Views::LocalizedAttributesTable

Inherits:
AttributesTable
  • Object
show all
Defined in:
lib/activeadmin-mongoid-localize/attributes_table.rb

Instance Method Summary collapse

Instance Method Details

#row(attr, &block) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/activeadmin-mongoid-localize/attributes_table.rb', line 6

def row(attr, &block)
  I18n.available_locales.each_with_index do |locale, index|
    @table << tr do
      if index == 0
        th :rowspan => I18n.available_locales.length do
          header_content_for(attr)
        end
      end
      td do
        I18n.with_locale locale do
          (
            image_tag("aml/flags/#{locale.to_s}.png", alt: locale.to_s, title: locale.to_s) +
            ' ' +
            content_for(block || attr)
          ).html_safe
        end
      end
    end
  end
end