Method: BootstrapTableHelper::Table#column
- Defined in:
- app/helpers/bootstrap_table_helper.rb
#column(width = nil, method = nil, options = {}, &block) ⇒ Object
options
width - 1~12
method - object's method, use send(method) to get value
h - options of header
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'app/helpers/bootstrap_table_helper.rb', line 61 def column(width=nil, method=nil, ={}, &block) width, method, = nil, nil, width if width.is_a?(Hash) method, = nil, method if method.is_a?(Hash) = .delete(:h) || {} .reverse_merge!(w: width) if width && width.to_i < 12 && width.to_i > 0 if method .reverse_merge!(method: method) align = case [:align] when 'center' :t when 'right' :r else :l end .reverse_merge!(align => self.[:obj].first.class.human_attribute_name(method)) unless self.[:obj].empty? end headers << unless .empty? columns << [, block] end |