Sha256: ca945d37f714b1f85da8c922b44bd0e7b2aea5617a29c798105b2bb977931299
Contents?: true
Size: 1.45 KB
Versions: 2
Compression:
Stored size: 1.45 KB
Contents
module ActiveAdmin module Views class LocalizedAttributesTable < ActiveAdmin::Views::AttributesTable builder_method :localize_attributes_table_for def row(*args, &block) _locales = ActiveAdmin::Localize.locales title = args[0] options = args.extract_options! classes = [:row] if options[:class] classes << options[:class] elsif title.present? classes << "row-#{ActiveAdmin::Dependency.rails.parameterize(title.to_s)}" end options[:class] = classes.join(' ') _locales.each_with_index do |locale, index| @table << tr do if index == 0 th :rowspan => _locales.length do header_content_for(title) end end @collection.each do |record| td do I18n.with_locale locale do ( image_tag("activeadmin-localize/#{locale.to_s}.svg", alt: locale.to_s, title: locale.to_s, width: 20, height: 15) + ' ' + content_for(record, block || title) ).html_safe end end end end end end protected def default_id_for_prefix 'attributes_table' end def default_class_name 'attributes_table' end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
activeadmin-localize-0.1.1 | lib/activeadmin-localize/attributes_table.rb |
activeadmin-localize-0.1.0 | lib/activeadmin-localize/attributes_table.rb |