Class: ActionView::Helpers::FormBuilder
- Inherits:
-
Object
- Object
- ActionView::Helpers::FormBuilder
- Extended by:
- HotDateRails::Utils
- Includes:
- FormTagHelper
- Defined in:
- app/helpers/form_helper.rb
Instance Method Summary collapse
- #hd_label(name = nil, content_or_options = nil, options = nil, &block) ⇒ Object
- #hd_picker(attr, opts = nil, locale_format = nil, cls = nil) ⇒ Object
-
#method_missing(method, *args) ⇒ Object
handle type-specific calls (to :date_picker, :time_picker and :datetime_picker).
Methods included from HotDateRails::Utils
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
handle type-specific calls (to :date_picker, :time_picker and :datetime_picker)
25 26 27 28 29 30 |
# File 'app/helpers/form_helper.rb', line 25 def method_missing(method, *args) cls = $1 if method =~ /(.*)_picker/ return super unless cls #not a valid picker method call args = (args + Array.new(3)).slice(0..2).push("#{cls}picker") #pad args to 3 and add cls attr to end send(:hd_picker, *args) end |
Instance Method Details
#hd_label(name = nil, content_or_options = nil, options = nil, &block) ⇒ Object
42 43 44 |
# File 'app/helpers/form_helper.rb', line 42 def hd_label(name = nil, = nil, = nil, &block) label_tag name, , , &block end |
#hd_picker(attr, opts = nil, locale_format = nil, cls = nil) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'app/helpers/form_helper.rb', line 32 def hd_picker(attr, opts=nil, locale_format=nil, cls=nil) opts ||= {} col_type = column_type(attr) #Picker css class...if not explicitly specified get it from the type cls ||= col_type.to_s + "picker" #need to specify datetime in locale file because rails thinks datetime is time locale_format ||= :datetime if col_type == :datetime draw_ext_input(attr, cls, locale_format, opts) end |