Module: Wice::JsCalendarHelpers

Included in:
ViewColumnDatetime
Defined in:
lib/helpers/js_calendar_helpers.rb

Instance Method Summary collapse

Instance Method Details

#date_calendar_jquery(initial_date, view, opts = {}, html_opts = {}) ⇒ Object

Jquery



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
# File 'lib/helpers/js_calendar_helpers.rb', line 6

def date_calendar_jquery(initial_date, view, opts = {}, html_opts = {})  #:nodoc:
  date_format = Wice::Defaults::DATE_FORMAT

  options, name, date_string, dom_id, datepicker_placeholder_id, date_span_id =
    prepare_data_for_calendar(opts, date_format, initial_date)

  remove_date_function = %! $('##{date_span_id}').html(''); $('##{dom_id}')[0].value = ''; !

  date_picker =

    hidden_field_tag(name, date_string, :id => dom_id) + ' ' +

    link_to_function(
      (:span, date_string, :id => date_span_id),
      remove_date_function,
      :class => 'date_label',
      :title => ::Wice::WiceGridNlMessageProvider.get_message(:DATE_STRING_TOOLTIP))

  html = "<span id=\"#{datepicker_placeholder_id}\">#{date_picker}</span>"

  javascript = calendar_constructor_jquery(dom_id, view, Wice::Defaults::DATE_FORMAT_JQUERY,
    date_span_id, opts[:fire_event], html_opts[:title], datepicker_placeholder_id)

  [html, javascript]
end

#date_calendar_prototype(initial_date, view, opts = {}, html_opts = {}) ⇒ Object

Prototype



33
34
35
# File 'lib/helpers/js_calendar_helpers.rb', line 33

def date_calendar_prototype(initial_date, view, opts = {}, html_opts = {})  #:nodoc:
  select_date_datetime_common_prototype(initial_date, view, opts, html_opts, false, Wice::Defaults::DATE_FORMAT)
end

#datetime_calendar_prototype(initial_date, view, opts = {}, html_opts = {}) ⇒ Object

:nodoc:



37
38
39
# File 'lib/helpers/js_calendar_helpers.rb', line 37

def datetime_calendar_prototype(initial_date, view, opts = {}, html_opts = {})  #:nodoc:
  select_date_datetime_common_prototype(initial_date, view, opts, html_opts, true, Wice::Defaults::DATETIME_FORMAT)
end