Module: UnobtrusiveDatePicker::UnobtrusiveDatePickerHelper
- Included in:
- ActionView::Helpers::InstanceTag
- Defined in:
- lib/unobtrusive_date_picker.rb
Overview
Unobtrusive Date-Picker Helper
This Module helps to create date and date-time fields that use the Unobtrusive Date-Picker Javascript Widget.
They also use the 12-hour AM/PM time format.
Instance Method Summary collapse
-
#unobtrusive_date_picker(object_name, method, options = {}, html_options = {}) ⇒ Object
Creates the date picker with the calendar widget.
- #unobtrusive_date_picker_tags(date = Date.current, options = {}, html_options = {}) ⇒ Object
-
#unobtrusive_date_text_picker(object_name, method, options = {}, html_options = {}) ⇒ Object
Creates the date picker with the calendar widget.
-
#unobtrusive_date_text_picker_tag(name, date = Date.current, options = {}, html_options = {}) ⇒ Object
Creates the text field based date picker with the calendar widget without a model object.
-
#unobtrusive_datetime_picker(object_name, method, options = {}, html_options = {}) ⇒ Object
Creates the date-time picker with the calendar widget, and AM/PM select.
- #unobtrusive_datetime_picker_tags(datetime = Time.current, options = {}, html_options = {}) ⇒ Object
Instance Method Details
#unobtrusive_date_picker(object_name, method, options = {}, html_options = {}) ⇒ Object
Creates the date picker with the calendar widget.
36 37 38 |
# File 'lib/unobtrusive_date_picker.rb', line 36 def unobtrusive_date_picker(object_name, method, = {}, = {}) ActionView::Helpers::InstanceTag.new(object_name, method, self, .delete(:object)).to_datepicker_date_select_tag(, ) end |
#unobtrusive_date_picker_tags(date = Date.current, options = {}, html_options = {}) ⇒ Object
59 60 61 62 |
# File 'lib/unobtrusive_date_picker.rb', line 59 def (date = Date.current, = {}, = {}) date ||= Date.current DateTimePickerSelector.new(date, , ).select_date end |
#unobtrusive_date_text_picker(object_name, method, options = {}, html_options = {}) ⇒ Object
Creates the date picker with the calendar widget.
50 51 52 |
# File 'lib/unobtrusive_date_picker.rb', line 50 def unobtrusive_date_text_picker(object_name, method, = {}, = {}) ActionView::Helpers::InstanceTag.new(object_name, method, self, .delete(:object)).to_datepicker_text_tag(, ) end |
#unobtrusive_date_text_picker_tag(name, date = Date.current, options = {}, html_options = {}) ⇒ Object
Creates the text field based date picker with the calendar widget without a model object.
67 68 69 70 71 |
# File 'lib/unobtrusive_date_picker.rb', line 67 def unobtrusive_date_text_picker_tag(name, date = Date.current, = {}, = {}) date ||= Date.current = merge_defaults_for_text_picker() DateTimePickerSelector.new(date, , ).text_date_picker(name) end |
#unobtrusive_datetime_picker(object_name, method, options = {}, html_options = {}) ⇒ Object
Creates the date-time picker with the calendar widget, and AM/PM select.
43 44 45 |
# File 'lib/unobtrusive_date_picker.rb', line 43 def unobtrusive_datetime_picker(object_name, method, = {}, = {}) ActionView::Helpers::InstanceTag.new(object_name, method, self, .delete(:object)).to_datepicker_datetime_select_tag(, ) end |
#unobtrusive_datetime_picker_tags(datetime = Time.current, options = {}, html_options = {}) ⇒ Object
54 55 56 57 |
# File 'lib/unobtrusive_date_picker.rb', line 54 def (datetime = Time.current, = {}, = {}) datetime ||= Time.current DateTimePickerSelector.new(datetime, .merge(:twelve_hour => true), ).select_datetime end |