lib/trestle/table/row.rb in trestle-0.8.6 vs lib/trestle/table/row.rb in trestle-0.8.7
- old
+ new
@@ -17,9 +17,19 @@
def initialize(row, template)
@row, @template = row, template
end
+ def columns
+ table.columns.map { |column| column.renderer(@template) }
+ end
+
+ def render(instance)
+ @template.content_tag(:tr, options(instance)) do
+ @template.safe_join(columns.map { |column| column.render(instance) }, "\n")
+ end
+ end
+
def options(instance)
options = Trestle::Options.new
if table.admin && table.autolink?
options.merge!(data: { url: admin_url_for(instance) })