lib/trestle/table/column.rb in trestle-0.10.0 vs lib/trestle/table/column.rb in trestle-0.10.1
- old
+ new
@@ -34,11 +34,11 @@
def initialize(column, table:, template:)
@column, @table, @template = column, table, template
end
def render(instance)
- @template.content_tag(:td, content(instance), class: classes, data: data)
+ @template.tag.td(content(instance), class: classes, data: data)
end
def render?
if options.key?(:if)
if options[:if].respond_to?(:call)
@@ -59,18 +59,19 @@
def header
return if options.key?(:header) && options[:header].in?([nil, false])
if @table.sortable? && @column.sortable?
- @template.sort_link(header_text, @column.sort_field, @column.sort_options)
+ link_options = @column.sort_options.slice(:default, :default_order)
+ @template.sort_link(header_text, @column.sort_field, **link_options)
else
header_text
end
end
def content(instance)
value = column_value(instance)
- content = @template.format_value(value, options)
+ content = @template.format_value(value, **options)
if value.respond_to?(:id) && options[:link] != false
# Column value was a model instance (e.g. from an association).
# Automatically link to instance's admin if available
content = @template.admin_link_to(content, value)