Module: Wice::JsCalendarHelpers
- Included in:
- Columns::ViewColumnJqueryDatepicker
- Defined in:
- lib/wice/helpers/js_calendar_helpers.rb
Overview
:nodoc:
Defined Under Namespace
Classes: CalendarData
Instance Method Summary collapse
-
#date_calendar_jquery(calendar_data) ⇒ Object
:nodoc:.
-
#prepare_data_for_calendar(options) ⇒ Object
:nodoc:.
Instance Method Details
#date_calendar_jquery(calendar_data) ⇒ Object
:nodoc:
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/wice/helpers/js_calendar_helpers.rb', line 20 def date_calendar_jquery(calendar_data) #:nodoc: = { :id => calendar_data.dom_id, 'data-locale' => I18n.locale, 'data-date-format' => Wice::ConfigurationProvider.value_for(:DATE_FORMAT_JQUERY), 'data-button-text' => calendar_data.title } if calendar_data.fire_event ['data-close-calendar-event-name'] = calendar_data.close_calendar_event_name end if Rails.env.development? ['class'] = 'check-for-datepicker' end if calendar_data.the_other_datepicker_id_to ['data-the-other-datepicker-id-to'] = calendar_data.the_other_datepicker_id_to end if calendar_data.the_other_datepicker_id_from ['data-the-other-datepicker-id-from'] = calendar_data.the_other_datepicker_id_from end if year_range = ConfigurationProvider.value_for(:DATEPICKER_YEAR_RANGE) ['data-date-year-range'] = year_range end date_picker = hidden_field_tag(calendar_data.name, calendar_data.date_string, ) + ' ' + link_to( calendar_data.date_string, '#', :id => calendar_data.date_span_id, :class => 'date-label', :title => ::Wice::NlMessage['date_string_tooltip'], 'data-dom-id' => calendar_data.dom_id ) content_tag( :span, date_picker, id: calendar_data.datepicker_placeholder_id, class: 'jq-datepicker-container' ) end |
#prepare_data_for_calendar(options) ⇒ Object
:nodoc:
67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/wice/helpers/js_calendar_helpers.rb', line 67 def prepare_data_for_calendar() #:nodoc: date_format = Wice::ConfigurationProvider.value_for(:DATE_FORMAT) CalendarData.new.tap do |calendar_data| calendar_data.name = [:name] calendar_data.date_string = [:initial_date].nil? ? '' : [:initial_date].strftime(date_format) calendar_data.dom_id = [:name].gsub(/([\[\(])|(\]\[)/, '_').gsub(/[\]\)]/, '').gsub(/\./, '_').gsub(/_+/, '_') calendar_data.datepicker_placeholder_id = calendar_data.dom_id + '_date_placeholder' calendar_data.date_span_id = calendar_data.dom_id + '_date_view' calendar_data.close_calendar_event_name = "wg:calendarChanged_#{[:grid_name]}" calendar_data.title = [:title] calendar_data.fire_event = [:fire_event] end end |