Class: ActiveScaffold::Bridges::DatePicker

Inherits:
DataStructures::Bridge show all
Defined in:
lib/active_scaffold/bridges/date_picker.rb,
lib/active_scaffold/bridges/date_picker/ext.rb,
lib/active_scaffold/bridges/date_picker/helper.rb

Defined Under Namespace

Modules: AttributeParams, DatePickerBridge, Finder, Helper

Class Method Summary collapse

Methods inherited from DataStructures::Bridge

javascripts, prepare, run

Class Method Details

.installObject



4
5
6
# File 'lib/active_scaffold/bridges/date_picker.rb', line 4

def self.install
  require File.join(File.dirname(__FILE__), 'date_picker/ext.rb')
end

.install?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/active_scaffold/bridges/date_picker.rb', line 8

def self.install?
  ActiveScaffold.js_framework == :jquery && jquery_ui_included?
end

.jquery_ui_included?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/active_scaffold/bridges/date_picker.rb', line 12

def self.jquery_ui_included?
  Jquery::Rails.const_defined?('JQUERY_UI_VERSION') || Jquery.const_defined?('Ui') if Object.const_defined?('Jquery')
end

.localizationObject



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/active_scaffold/bridges/date_picker.rb', line 20

def self.localization
  "jQuery(function($){
  if (typeof($.datepicker) === 'object') {
#{Helper.date_options_for_locales}
$.datepicker.setDefaults($.datepicker.regional['#{::I18n.locale}']);
  }
  if (typeof($.timepicker) === 'object') {
#{Helper.datetime_options_for_locales}
$.timepicker.setDefaults($.timepicker.regional['#{::I18n.locale}']);
  }
});\n"
end

.stylesheetsObject



16
17
18
# File 'lib/active_scaffold/bridges/date_picker.rb', line 16

def self.stylesheets
  'jquery-ui-timepicker-addon'
end