Class: ActiveScaffold::Bridges::DatePicker

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

Defined Under Namespace

Modules: Helper

Class Method Summary collapse

Methods inherited from DataStructures::Bridge

javascripts, run, stylesheets

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



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

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

.jquery_ui_included?Boolean



10
11
12
# File 'lib/active_scaffold/bridges/date_picker.rb', line 10

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

.localizationObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/active_scaffold/bridges/date_picker.rb', line 13

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