lib/table_settings/table_column.rb in it-logica-application-backbone-1.0.38 vs lib/table_settings/table_column.rb in it-logica-application-backbone-1.0.39

- old
+ new

@@ -1,21 +1,24 @@ class TableSettings attr_accessor :table_settings class Column - attr_accessor :column_hash, :index + attr_accessor :index def initialize(table_settings, index) @table_settings = table_settings @column_hash = {} @index = index end + def column_hash + @column_hash + end def css_class(class_name) - @column_hash[:class_name] = class_name + @column_hash[:class] = class_name self end def filter_type(filter_type) @@ -138,9 +141,31 @@ # Table for column def table(name) @column_hash[:table] = name self end + + + 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 + + #def column_hash + # + # unless @column_hash.include?(:class) + # model = @column_hash[:table].classify.constantize + # set_css_class_from_type(model) unless model.nil? + # end + # + # @column_hash + #end end end \ No newline at end of file