Module: Wice::Columns
- Defined in:
- lib/wice/columns.rb,
lib/wice/columns/column_date.rb,
lib/wice/columns/column_float.rb,
lib/wice/columns/column_range.rb,
lib/wice/columns/column_action.rb,
lib/wice/columns/column_string.rb,
lib/wice/columns/column_boolean.rb,
lib/wice/columns/column_integer.rb,
lib/wice/columns/column_datetime.rb,
lib/wice/columns/column_custom_dropdown.rb,
lib/wice/columns/column_processor_index.rb
Overview
:nodoc:
Defined Under Namespace
Classes: ConditionsGeneratorColumn, ConditionsGeneratorColumnBoolean, ConditionsGeneratorColumnCustomDropdown, ConditionsGeneratorColumnDate, ConditionsGeneratorColumnDatetime, ConditionsGeneratorColumnInteger, ConditionsGeneratorColumnRange, ConditionsGeneratorColumnString, ViewColumn, ViewColumnAction, ViewColumnBoolean, ViewColumnCustomDropdown, ViewColumnDate, ViewColumnDatetime, ViewColumnFloat, ViewColumnInteger, ViewColumnRange, ViewColumnString
Constant Summary collapse
- ConditionsGeneratorColumnFloat =
:nodoc:
ConditionsGeneratorColumnInteger
- ConditionsGeneratorColumnAction =
:nodoc:
ConditionsGeneratorColumn
- COLUMN_PROCESSOR_INDEX =
:nodoc:
ActiveSupport::OrderedHash[ #:nodoc: :action , 'column_action', # Special processor for action column, columns with checkboxes :text , 'column_string', :string , 'column_string', :timestamp, 'column_datetime', :datetime , 'column_datetime', :date , 'column_date', :integer , 'column_integer', :range , 'column_range', :float , 'column_float', :decimal , 'column_float', :custom , 'column_custom_dropdown', # Special processor for custom filter columns :boolean , 'column_boolean' ]
Class Method Summary collapse
-
.get_conditions_generator_column_processor(column_type) ⇒ Object
:nodoc:.
-
.get_view_column_processor(column_type) ⇒ Object
:nodoc:.
-
.load_column_processors ⇒ Object
:nodoc:.
Class Method Details
.get_conditions_generator_column_processor(column_type) ⇒ Object
:nodoc:
69 70 71 72 |
# File 'lib/wice/columns.rb', line 69 def get_conditions_generator_column_processor(column_type) #:nodoc: column_type = column_type.intern if column_type.is_a? String @@handled_type_conditions_generator[column_type] || raise("Could not find conditions generator processor for column_type #{column_type}") end |
.get_view_column_processor(column_type) ⇒ Object
:nodoc:
65 66 67 |
# File 'lib/wice/columns.rb', line 65 def get_view_column_processor(column_type) #:nodoc: @@handled_type_view[column_type] || ViewColumn end |
.load_column_processors ⇒ Object
:nodoc:
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/wice/columns.rb', line 10 def load_column_processors #:nodoc: require_columns loaded_view_column_processors = Hash.new @@handled_type_view = build_table_of_processors 'view' @@handled_type_conditions_generator = build_table_of_processors 'conditions_generator' if Wice::Defaults.const_defined?(:ADDITIONAL_COLUMN_PROCESSORS) common_error_prefix = "Error loading Wice::Defaults::ADDITIONAL_COLUMN_PROCESSORS. " Wice::Defaults::ADDITIONAL_COLUMN_PROCESSORS.each do |key, value| unless key.is_a?(Symbol) raise common_error_prefix + "A key of Wice::Defaults::ADDITIONAL_COLUMN_PROCESSORS should be a Symbol!" end if @@handled_type_view.has_key?(key) raise common_error_prefix + "Column with key \"#{key}\" already exists in WiceGrid, overwriting existing columns is forbidden, please choose another key!" end if ! value.is_a?(Array) || value.size != 2 raise common_error_prefix + "A value of Wice::Defaults::ADDITIONAL_COLUMN_PROCESSORS should be a a 2-element array!" end view_processor, conditions_generator = value.map(&:to_s).map do |klass| begin eval(klass) rescue NameError raise common_error_prefix + "Class #{klass} is not defined!" end end unless view_processor.ancestors.include?(::Wice::Columns::ViewColumn) raise common_error_prefix + "#{view_processor} should be inherited from Wice::Columns::ViewColumn!" end unless conditions_generator.ancestors.include?(::Wice::Columns::ConditionsGeneratorColumn) raise common_error_prefix + "#{conditions_generator} should be inherited from Wice::Columns::ConditionsGeneratorColumn!" end @@handled_type_view[key] = view_processor @@handled_type_conditions_generator[key] = conditions_generator end end end |