Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/table_cloth/extensions/row_attributes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ def tr_options
@tr_options
end

def tr_options_for(object)
def tr_options_for(object, view_context)
options = tr_options
if options.include?(:proc)
result = options[:proc].call(object) || {}
result = options[:proc].call(object, view_context) || {}
options.except(:proc).merge(result)
else
options
Expand Down
6 changes: 3 additions & 3 deletions lib/table_cloth/presenters/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def thead

def tbody
@tbody ||= ElementFactory::Element.new(:tbody, tag_options(:tbody)).tap do |tbody|
objects.each {|object| tbody << row_for_object(object) }
objects.each {|object| tbody << row_for_object(object, view_context) }
end
end

Expand All @@ -32,8 +32,8 @@ def thead_row
end
end

def row_for_object(object)
tr_options = table.class.tr_options_for(object)
def row_for_object(object, view_context)
tr_options = table.class.tr_options_for(object, view_context)

ElementFactory::Element.new(:tr, tag_options(:tr).merge(tr_options)).tap do |row|
columns.each do |column|
Expand Down