Class: ActiveAdmin::Translate::TranslateAttributesTable

Inherits:
Views::AttributesTable
  • Object
show all
Defined in:
lib/active_admin/views/translate_attributes_table.rb

Overview

Adds a builder method ‘translate_attributes_table_for` to build a table with translations for a model that has been localized with Globalize3.

Instance Method Summary collapse

Instance Method Details

#row(attr, &block) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/active_admin/views/translate_attributes_table.rb', line 12

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
          content_for(block || attr)
        end
      end
    end
  end
end