Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #50 from bikeexchange/allow_class_per_column

Allow HTML class to be specified for each column in the report.
  • Loading branch information...
commit 39f80485f163f1ba2091026e7e816cf15170bda8 2 parents 814e5f0 + bae92d1
@bogdan authored
Showing with 13 additions and 2 deletions.
  1. +2 −2 lib/datagrid/helper.rb
  2. +11 −0 spec/datagrid/helper_spec.rb
View
4 lib/datagrid/helper.rb
@@ -31,8 +31,8 @@ def datagrid_renderer
end
def datagrid_column_classes(grid, column)
- order_class = grid.order == column.name ? ["ordered", grid.descending ? "desc" : "asc"] : nil
- [column.name, order_class].compact.join(" ")
+ order_class = grid.order == column.name ? ["ordered", grid.descending ? "desc" : "asc"] : nil
+ [column.name, order_class, column.options[:class]].compact.join(" ")
end
end
end
View
11 spec/datagrid/helper_spec.rb
@@ -176,6 +176,17 @@
)
end
+ it "should allow CSS classes to be specified for a column" do
+ rp = test_report do
+ scope { Entry }
+ column(:name, :class => 'my_class')
+ end
+
+ subject.datagrid_rows(rp, [entry]).should match_css_pattern(
+ "tr td.name.my_class" => "Star"
+ )
+ end
+
end
describe ".datagrid_order_for" do
Please sign in to comment.
Something went wrong with that request. Please try again.