Permalink
Browse files

Columns: fixed html options and second column block argument compatib…

…ility
  • Loading branch information...
1 parent 380a18d commit c4e3b9fdfee742d30c0efd009d8e4c9250524df6 @bogdan bogdan committed Apr 9, 2012
Showing with 14 additions and 1 deletion.
  1. +1 −1 lib/datagrid/renderer.rb
  2. +13 −0 spec/datagrid/helper_spec.rb
@@ -12,7 +12,7 @@ def initialize(template)
end
def format_value(grid, column, asset)
- value = column.html? ? @template.instance_exec(asset, &column.block) : column.value(asset, grid)
+ value = column.html? ? @template.instance_exec(asset, grid, &column.block) : column.value(asset, grid)
url = column.options[:url] && column.options[:url].call(asset)
if url
@template.link_to(value, url)
@@ -125,6 +125,19 @@
"tr td.name span" => "Star"
)
end
+
+ it "should render html columns with double arguments for column" do
+ rp = test_report do
+ scope { Entry }
+ column(:name, :html => true) do |model, grid|
+ content_tag(:span, "#{model.name}-#{grid.assets.klass}" )
+ end
+ end
+ subject.datagrid_rows(rp, [entry]).should match_css_pattern(
+ "tr td.name span" => "Star-Entry"
+ )
+ end
+
end
describe ".datagrid_order_for" do

0 comments on commit c4e3b9f

Please sign in to comment.