class ActionAdmin::Table
Public Class Methods
new(name, options)
click to toggle source
# File lib/action_admin/table.rb, line 8 def initialize(name, options) self.name = name self.options = options self.columns = {} self.header = {} end
Public Instance Methods
column(name, options={})
click to toggle source
# File lib/action_admin/table.rb, line 15 def column(name, options={}) self.columns = self.columns.merge(name => options) self.header = self.header.merge(name => set_column_header(name, options)) end
merge(table)
click to toggle source
# File lib/action_admin/table.rb, line 20 def merge(table) if table.is_a? ActionAdmin::Table self.options = table.options.deep_merge(self.options) self.columns = table.columns.merge(self.columns) self.header = table.header.merge(self.header) end end
Private Instance Methods
set_column_header(name, options={})
click to toggle source
# File lib/action_admin/table.rb, line 30 def set_column_header(name, options={}) label = options.fetch(:label, name.to_s.titleize) html = options.fetch(:html, {}) { label: label, html: html } end