Module: UiDatePickerRails3::ClassMethods
- Included in:
- UiDatePickerRails3
- Defined in:
- lib/ui_datepicker-rails3.rb
Instance Method Summary collapse
- #activate(*names) ⇒ Object
- #activate_one(name) ⇒ Object
- #load_extension(name) ⇒ Object
- #ui_localizers(*country_codes) ⇒ Object
- #ui_theme(theme) ⇒ Object
- #valid_framework?(name) ⇒ Boolean
Instance Method Details
#activate(*names) ⇒ Object
6 7 8 9 |
# File 'lib/ui_datepicker-rails3.rb', line 6 def activate *names names = names.flatten names.each {|name| activate_one name } end |
#activate_one(name) ⇒ Object
11 12 13 14 |
# File 'lib/ui_datepicker-rails3.rb', line 11 def activate_one name valid_framework? name load_extension name end |
#load_extension(name) ⇒ Object
16 17 18 19 20 |
# File 'lib/ui_datepicker-rails3.rb', line 16 def load_extension name require "#{name}/inputs_ext" rescue Exception => e raise NotImplementedError, "Unsupported Formbuilder or framework: #{name} - #{e}" end |
#ui_localizers(*country_codes) ⇒ Object
37 38 39 |
# File 'lib/ui_datepicker-rails3.rb', line 37 def ui_localizers *country_codes country_codes.map {|cc| "ui/i18n/jquery.ui.datepicker-#{cc}" } end |
#ui_theme(theme) ⇒ Object
33 34 35 |
# File 'lib/ui_datepicker-rails3.rb', line 33 def ui_theme theme "ui/#{theme}/jquery-ui-theme" end |
#valid_framework?(name) ⇒ Boolean
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ui_datepicker-rails3.rb', line 22 def valid_framework? name case name.to_sym when :simple_form raise ArgumentError, "SimpleForm not defined" unless defined?(SimpleForm) when :formtastic raise ArgumentError, "Formtastic not defined" unless defined?(Formtastic) when :active_admin raise ArgumentError, "ActiveAdmin not defined" unless defined?(ActiveAdmin) end end |