6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/activeadmin-localize/attributes_table.rb', line 6
def row(*args, &block)
_locales = ActiveAdmin::Localize.locales
title = args[0]
options = args.
classes = [:row]
if options[:class]
classes << options[:class]
elsif title.present?
classes << "row-#{title.to_s.parameterize(separator: "_")}"
end
options[:class] = classes.join(' ')
_locales.each_with_index do |locale, index|
@table << tr(options) do
if index == 0
th :rowspan => _locales.length do
(title)
end
end
@collection.each do |record|
data = nil
I18n.with_locale locale do
val = record.send(title)
data = content_tag :div do
(
image_tag("activeadmin-localize/#{locale.to_s}.svg", alt: locale.to_s, title: locale.to_s, width: 20, height: 15) +
' ' +
(val.blank? ? "-" : CGI.escapeHTML(val)).html_safe
)
end
end
td data
end
end
end
end
|