Class: Wice::ViewColumnDatetime
- Inherits:
-
ViewColumn
- Object
- ViewColumn
- Wice::ViewColumnDatetime
- Includes:
- ActionView::Helpers::DateHelper, JsCalendarHelpers
- Defined in:
- lib/view_columns/view_column_datetime.rb
Overview
:nodoc:
Direct Known Subclasses
Constant Summary collapse
- @@datetime_chunk_names =
%w(year month day hour minute)
Constants inherited from ViewColumn
Instance Attribute Summary
Attributes inherited from ViewColumn
#cell_rendering_block, #contains_a_text_input, #css_class, #custom_filter, #grid, #main_table, #model, #table_name
Instance Method Summary collapse
-
#has_auto_reloading_calendar? ⇒ Boolean
:nodoc:.
-
#name_and_id_from_options(options, type) ⇒ Object
name_and_id_from_options in Rails Date helper does not substitute ‘.’ with ‘_’ like all other simpler form helpers do.
-
#prepare_for_calendar_filter ⇒ Object
:nodoc:.
-
#prepare_for_standard_filter ⇒ Object
:nodoc:.
-
#render_calendar_filter_internal(params) ⇒ Object
:nodoc:.
-
#render_filter_internal(params) ⇒ Object
:nodoc:.
-
#render_standard_filter_internal(params) ⇒ Object
:nodoc:.
-
#yield_declaration_of_column_filter ⇒ Object
:nodoc:.
Methods included from JsCalendarHelpers
Methods inherited from ViewColumn
#attribute_name_fully_qualified_for_all_but_main_table_columns, #auto_reloading_input_with_negation_checkbox?, #capable_of_hosting_filter_related_icons?, #config, #controller, #detachness, #filter_shown?, #filter_shown_in_main_table?, #form_parameter_name_id_and_query, #fully_qualified_attribute_name, get_column_processor, #has_auto_reloading_input?, #has_auto_reloading_select?, #initialize, load_column_processors, #render_filter, #table_alias_or_table_name, #yield_declaration
Constructor Details
This class inherits a constructor from Wice::ViewColumn
Instance Method Details
#has_auto_reloading_calendar? ⇒ Boolean
:nodoc:
79 80 81 |
# File 'lib/view_columns/view_column_datetime.rb', line 79 def has_auto_reloading_calendar? #:nodoc: auto_reload && helper_style == :calendar end |
#name_and_id_from_options(options, type) ⇒ Object
name_and_id_from_options in Rails Date helper does not substitute ‘.’ with ‘_’ like all other simpler form helpers do. Thus, overriding it here.
11 12 13 14 |
# File 'lib/view_columns/view_column_datetime.rb', line 11 def (, type) #:nodoc: [:name] = ([:prefix] || DEFAULT_PREFIX) + ([:discard_type] ? '' : "[#{type}]") [:id] = [:name].gsub(/([\[\(])|(\]\[)/, '_').gsub(/[\]\)]/, '').gsub(/\./, '_').gsub(/_+/, '_') end |
#prepare_for_calendar_filter ⇒ Object
:nodoc:
33 34 35 36 37 38 |
# File 'lib/view_columns/view_column_datetime.rb', line 33 def prepare_for_calendar_filter #:nodoc: query, _, @name1, @dom_id = form_parameter_name_id_and_query(:fr => '') query2, _, @name2, @dom_id2 = form_parameter_name_id_and_query(:to => '') @queris_ids = [[query, @dom_id], [query2, @dom_id2] ] end |
#prepare_for_standard_filter ⇒ Object
:nodoc:
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/view_columns/view_column_datetime.rb', line 18 def prepare_for_standard_filter #:nodoc: x = lambda{|sym| @@datetime_chunk_names.collect{|datetime_chunk_name| triple = form_parameter_name_id_and_query(sym => {datetime_chunk_name => ''}) [triple[0], triple[3]] } } @queris_ids = x.call(:fr) + x.call(:to) _, _, @name1, _ = form_parameter_name_id_and_query({:fr => ''}) _, _, @name2, _ = form_parameter_name_id_and_query({:to => ''}) end |
#render_calendar_filter_internal(params) ⇒ Object
:nodoc:
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/view_columns/view_column_datetime.rb', line 48 def render_calendar_filter_internal(params) #:nodoc: html1 = date_calendar_jquery( params[:fr], NlMessage['date_selector_tooltip_from'], :prefix => @name1, :fire_event => auto_reload, :grid_name => self.grid.name) html2 = date_calendar_jquery( params[:to], NlMessage['date_selector_tooltip_to'], :prefix => @name2, :fire_event => auto_reload, :grid_name => self.grid.name) %!<div class="date-filter">#{html1}<br/>#{html2}</div>! end |
#render_filter_internal(params) ⇒ Object
:nodoc:
60 61 62 63 64 65 66 67 68 |
# File 'lib/view_columns/view_column_datetime.rb', line 60 def render_filter_internal(params) #:nodoc: if helper_style == :standard prepare_for_standard_filter render_standard_filter_internal(params) else prepare_for_calendar_filter render_calendar_filter_internal(params) end end |
#render_standard_filter_internal(params) ⇒ Object
:nodoc:
41 42 43 44 45 46 |
# File 'lib/view_columns/view_column_datetime.rb', line 41 def render_standard_filter_internal(params) #:nodoc: '<div class="date-filter">' + select_datetime(params[:fr], {:include_blank => true, :prefix => @name1}) + '<br/>' + select_datetime(params[:to], {:include_blank => true, :prefix => @name2}) + '</div>' end |
#yield_declaration_of_column_filter ⇒ Object
:nodoc:
71 72 73 74 75 76 |
# File 'lib/view_columns/view_column_datetime.rb', line 71 def yield_declaration_of_column_filter #:nodoc: { :templates => @queris_ids.collect{|tuple| tuple[0] }, :ids => @queris_ids.collect{|tuple| tuple[1] } } end |