Browse files

Merge branch 'master' of github.com:bogdan/datagrid

  • Loading branch information...
2 parents 622e21b + 39f8048 commit 45baf7007418d64d3a410160502104809fac9b54 @bogdan committed Dec 10, 2012
Showing with 15 additions and 3 deletions.
  1. +2 −1 lib/datagrid/columns.rb
  2. +2 −2 lib/datagrid/helper.rb
  3. +11 −0 spec/datagrid/helper_spec.rb
View
3 lib/datagrid/columns.rb
@@ -124,7 +124,8 @@ def columns(*args)
end
def data_columns(*names)
- self.columns(*names, :data => true)
+ names << {:data => true}
+ self.columns(*names)
end
def column_by_name(name)
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

0 comments on commit 45baf70

Please sign in to comment.