Class: Wice::Columns::ViewColumnRailsDatetimeHelper

Inherits:
ViewColumn show all
Includes:
ActionView::Helpers::DateHelper, CommonDateDatetimeMixin, CommonStandardDateDatetimeMixin
Defined in:
lib/wice/columns/column_rails_datetime_helper.rb

Overview

:nodoc:

Constant Summary

Constants inherited from ViewColumn

Wice::Columns::ViewColumn::FIELDS

Instance Attribute Summary

Attributes inherited from ViewColumn

#cell_rendering_block, #contains_a_text_input, #custom_filter, #filter_control_options, #grid, #main_table, #table_name

Instance Method Summary collapse

Methods included from CommonStandardDateDatetimeMixin

#prepare

Methods included from CommonDateDatetimeMixin

#render_filter_internal, #yield_declaration_of_column_filter

Methods inherited from ViewColumn

#add_css_class, #attribute_name_fully_qualified_for_all_but_main_table_columns, #auto_reloading_input_with_negation_checkbox?, #capable_of_hosting_filter_related_icons?, #config, #controller, #css_class, #detachness, #filter_shown?, #filter_shown_in_main_table?, #form_parameter_name_id_and_query, #fully_qualified_attribute_name, #has_auto_reloading_input?, #has_auto_reloading_select?, #initialize, #render_filter, #render_filter_internal, #table_alias_or_table_name, #yield_declaration, #yield_declaration_of_column_filter

Methods included from ActionView::Helpers::TagHelper

#public_tag_options

Constructor Details

This class inherits a constructor from Wice::Columns::ViewColumn

Instance Method Details

#chunk_namesObject

:nodoc:



9
10
11
# File 'lib/wice/columns/column_rails_datetime_helper.rb', line 9

def chunk_names #:nodoc:
  %w(year month day hour minute)
end

#do_render(params) ⇒ Object

:nodoc:



13
14
15
16
17
18
19
# File 'lib/wice/columns/column_rails_datetime_helper.rb', line 13

def do_render(params) #:nodoc:
  datetime_options = filter_control_options ? filter_control_options.slice(:start_year, :end_year, :max_year_allowed) : {}
  '<div class="date-filter">' +
    select_datetime(params[:fr], datetime_options.merge(include_blank: true, prefix: @name1)) + '<br/>' +
    select_datetime(params[:to], datetime_options.merge(include_blank: true, prefix: @name2)) +
    '</div>'
end

#has_auto_reloading_calendar?Boolean

:nodoc:

Returns:

  • (Boolean)


28
29
30
# File 'lib/wice/columns/column_rails_datetime_helper.rb', line 28

def has_auto_reloading_calendar? #:nodoc:
  false
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.



23
24
25
26
# File 'lib/wice/columns/column_rails_datetime_helper.rb', line 23

def name_and_id_from_options(options, type)  #:nodoc:
  options[:name] = (options[:prefix] || DEFAULT_PREFIX) + (options[:discard_type] ? '' : "[#{type}]")
  options[:id] = options[:name].gsub(/([\[\(])|(\]\[)/, '_').gsub(/[\]\)]/, '').gsub(/\./, '_').gsub(/_+/, '_')
end