Module: Wice::Columns
- Defined in:
- lib/wice/columns.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_custom_dropdown.rb,
lib/wice/columns/column_processor_index.rb,
lib/wice/columns/column_html5_datepicker.rb,
lib/wice/columns/column_jquery_datepicker.rb,
lib/wice/columns/column_rails_date_helper.rb,
lib/wice/columns/common_date_datetime_mixin.rb,
lib/wice/columns/column_bootstrap_datepicker.rb,
lib/wice/columns/column_rails_datetime_helper.rb,
lib/wice/columns/common_js_date_datetime_mixin.rb,
lib/wice/columns/common_standard_helper_date_datetime_mixin.rb,
lib/wice/columns/common_js_date_datetime_conditions_generator_mixin.rb,
lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb
Overview
:nodoc:
Defined Under Namespace
Modules: CommonDateDatetimeMixin, CommonJsDateDatetimeConditionsGeneratorMixin, CommonJsDateDatetimeMixin, CommonRailsDateDatetimeConditionsGeneratorMixin, CommonStandardDateDatetimeMixin Classes: ConditionsGeneratorColumn, ConditionsGeneratorColumnBoolean, ConditionsGeneratorColumnBootstrapDatepicker, ConditionsGeneratorColumnCustomDropdown, ConditionsGeneratorColumnHtml5Datepicker, ConditionsGeneratorColumnInteger, ConditionsGeneratorColumnJqueryDatepicker, ConditionsGeneratorColumnRailsDateHelper, ConditionsGeneratorColumnRailsDatetimeHelper, ConditionsGeneratorColumnRange, ConditionsGeneratorColumnString, ViewColumn, ViewColumnAction, ViewColumnBoolean, ViewColumnBootstrapDatepicker, ViewColumnCustomDropdown, ViewColumnFloat, ViewColumnHtml5Datepicker, ViewColumnInteger, ViewColumnJqueryDatepicker, ViewColumnRailsDateHelper, ViewColumnRailsDatetimeHelper, 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', :rails_datetime_helper, 'column_rails_datetime_helper', # standard Rails datepicker helper :rails_date_helper, 'column_rails_date_helper', # standard Rails date helper :jquery_datepicker, 'column_jquery_datepicker', :bootstrap_datepicker, 'column_bootstrap_datepicker', :html5_datepicker, 'column_html5_datepicker', # not ready :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:
59 60 61 62 |
# File 'lib/wice/columns.rb', line 59 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:
55 56 57 |
# File 'lib/wice/columns.rb', line 55 def get_view_column_processor(column_type) #:nodoc: @@handled_type_view[column_type] || ViewColumn end |
.load_column_processors ⇒ Object
:nodoc:
6 7 8 9 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 |
# File 'lib/wice/columns.rb', line 6 def load_column_processors #:nodoc: require_columns @@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.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 ail 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 |