Skip to content

Instantly share code, notes, and snippets.

@leikind
Created February 19, 2014 12:59
Show Gist options
  • Save leikind/9091465 to your computer and use it in GitHub Desktop.
Save leikind/9091465 to your computer and use it in GitHub Desktop.
minimalistic WG ViewColumnDate processor
# {
# "docs"=>
# {
# "f"=>
# {
# "document_date"=>
# {
# "fr"=>"2014-02-07",
# "to"=>"2014-02-21"
# },
# "imported_at"=>
# {
# "fr"=>"2014-02-13",
# "to"=>"2014-02-14"
# }
# }
# }
# }
class ViewColumnSophiaDate < Wice::Columns::ViewColumn
include ActionView::Helpers::DateHelper
include Wice::JsCalendarHelpers
def render_filter_internal(params) #: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]]
calendar_data_from = prepare_data_for_calendar(
:initial_date => params[:fr],
:title => ::Wice::NlMessage['date_selector_tooltip_from'],
:name => name1,
:fire_event => auto_reload,
:grid_name => self.grid.name
)
calendar_data_to = prepare_data_for_calendar(
:initial_date => params[:to],
:title => ::Wice::NlMessage['date_selector_tooltip_to'],
:name => name2,
:fire_event => auto_reload,
:grid_name => self.grid.name
)
calendar_data_from.the_other_datepicker_id_to = calendar_data_to.dom_id
calendar_data_to.the_other_datepicker_id_from = calendar_data_from.dom_id
html1 = date_calendar_jquery calendar_data_from
html2 = date_calendar_jquery calendar_data_to
%!<div class="date-filter">#{html1}<br/>#{html2}</div>!
end
def yield_declaration_of_column_filter #:nodoc:
{
:templates => @queris_ids.collect{|tuple| tuple[0] },
:ids => @queris_ids.collect{|tuple| tuple[1] }
}
end
def has_auto_reloading_input?
false
end
def auto_reloading_input_with_negation_checkbox?
false
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment