lib/active_admin/views/components/attributes_table.rb in activeadmin-3.2.5 vs lib/active_admin/views/components/attributes_table.rb in activeadmin-4.0.0.beta1

- old
+ new

@@ -9,10 +9,11 @@ @collection = Array.wrap(obj) @resource_class = @collection.first.class options = {} options[:for] = @collection.first if single_record? super(options) + add_class "attributes-table" @table = table build_colgroups rows(*attrs) end @@ -21,17 +22,11 @@ end def row(*args, &block) title = args[0] options = args.extract_options! - classes = [:row] - if options[:class] - classes << options[:class] - elsif title.present? - classes << "row-#{title.to_s.parameterize(separator: "_")}" - end - options[:class] = classes.join(" ") + options["data-row"] = title.to_s.parameterize(separator: "_") if title.present? @table << tr(options) do th do header_content_for(title) end @@ -57,14 +52,11 @@ return if single_record? reset_cycle(self.class.to_s) within @table do col # column for row headers @collection.each do |record| - classes = Arbre::HTML::ClassList.new - classes << cycle(:even, :odd, name: self.class.to_s) - classes << dom_class_name_for(record) - col(id: dom_id_for(record), class: classes) + col(id: dom_id_for(record)) end end end def header_content_for(attr) @@ -74,10 +66,10 @@ attr.to_s.titleize end end def empty_value - span I18n.t("active_admin.empty"), class: "empty" + span I18n.t("active_admin.empty"), class: "attributes-table-empty-value" end def content_for(record, attr) value = helpers.format_attribute record, attr value.blank? && current_arbre_element.children.to_s.empty? ? empty_value : value