lib/active_admin/views/components/table_for.rb in activeadmin-0.3.4 vs lib/active_admin/views/components/table_for.rb in activeadmin-0.4.0

- old
+ new

@@ -61,19 +61,23 @@ def build_table_header(col) if sortable? && col.sortable? build_sortable_header_for(col.title, col.sort_key) else - th(col.title) + th(col.title, :class => (col.data.to_s.downcase.underscore if col.data.is_a?(Symbol))) end end def build_sortable_header_for(title, sort_key) classes = Arbre::HTML::ClassList.new(["sortable"]) if current_sort[0] == sort_key classes << "sorted-#{current_sort[1]}" end + + header_class = title.downcase.underscore + + classes << header_class th :class => classes do link_to(title, params.merge(:order => "#{sort_key}_#{order_for_sort_key(sort_key)}").except(:page)) end end @@ -84,10 +88,10 @@ @collection.each{|_| tr(:class => cycle('odd', 'even'), :id => dom_id(_)) } end end def build_table_cell(col, item) - td do + td(:class => (col.data.to_s.downcase if col.data.is_a?(Symbol))) do rvalue = call_method_or_proc_on(item, col.data, :exec => false) if col.data.is_a?(Symbol) rvalue = pretty_format(rvalue) end rvalue