class Trestle::Table::SelectColumn::Renderer
Public Instance Methods
classes()
click to toggle source
# File lib/trestle/table/select_column.rb, line 23 def classes "select-row" end
content(instance)
click to toggle source
# File lib/trestle/table/select_column.rb, line 19 def content(instance) checkbox "selected[]", instance.to_param, id: checkbox_id(instance.to_param) end
data()
click to toggle source
# File lib/trestle/table/select_column.rb, line 27 def data {} end
header()
click to toggle source
# File lib/trestle/table/select_column.rb, line 15 def header checkbox "", nil, id: checkbox_id("all") end
Private Instance Methods
checkbox(name, value="1", options={})
click to toggle source
# File lib/trestle/table/select_column.rb, line 36 def checkbox(name, value="1", options={}) @template.content_tag(:div, class: "custom-control custom-checkbox") do @template.check_box_tag(name, value, false, options.merge(class: "custom-control-input")) + @template.tag(:label, for: options.fetch(:id), class: "custom-control-label") end end
checkbox_id(param)
click to toggle source
# File lib/trestle/table/select_column.rb, line 32 def checkbox_id(param) [@table.options[:id], "select", param].compact.join("-") end