Class: TableSettings::StandardColumn

Inherits:
Column
  • Object
show all
Defined in:
lib/table_settings/table_column.rb

Instance Attribute Summary

Attributes inherited from Column

#index

Instance Method Summary collapse

Methods inherited from Column

#column_hash, #css_class, #css_header_class, #csv_excluded, #editable, #filter_data, #filter_type, #format_method, #global_format_method, #inactive_filter, #initialize, #max_text_length, #non_breakable, #non_sortable, #sql_expression, #summarize_all, #summarize_page, #title

Constructor Details

This class inherits a constructor from TableSettings::Column

Instance Method Details

#params(name, label, table) ⇒ Object



172
173
174
175
176
177
178
179
180
181
182
# File 'lib/table_settings/table_column.rb', line 172

def params(name, label, table)

  @column_hash = {
      :name   => name,
      :label  => label,
      :table  => table,
      :filter => :find
  }

  self
end

#set_css_class_from_type(model) ⇒ Object



191
192
193
194
195
196
197
198
199
200
# File 'lib/table_settings/table_column.rb', line 191

def set_css_class_from_type(model)
  column_params = model.columns_hash[@column_hash[:name]]
  case column_params.type
    when :boolean then css_class("boolean")
    when :datetime then css_class("datetime")
    when :string then css_class("string")
    when :decimal then css_class("decimal")
    else nil
  end
end

#table(name) ⇒ Object

Table for column



185
186
187
188
# File 'lib/table_settings/table_column.rb', line 185

def table(name)
  @column_hash[:table] = name
  self
end