Sha256: 51f88c3374ea00bc8070a9601418c32d3d5f9453bd02f01664fd383d321a340d

Contents?: true

Size: 735 Bytes

Versions: 13

Compression:

Stored size: 735 Bytes

Contents

module MotionPrime
  class DateFieldSection < BaseFieldSection
    container height: 190
    element :label, type: :label do
      default_label_options
    end
    element :input, type: :date_picker do
      options[:input] || {}
    end

    after_element_render :input, :bind_input

    def bind_input
      picker = view(:input)
      picker.setDelegate form
      unless picker.date
        picker.setDate NSDate.date, animated: true
      end
      picker.on :change do
        form.send(options[:action]) if options[:action]
      end
    end

    def value
      view(:input).date
    end

    def input?
      true
    end

    def dealloc
      picker = view(:input)
      picker.setDelegate nil
      super
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
motion-prime-1.0.7 motion-prime/sections/form/date_field_section.rb
motion-prime-1.0.6 motion-prime/sections/form/date_field_section.rb
motion-prime-1.0.5 motion-prime/sections/form/date_field_section.rb
motion-prime-1.0.4 motion-prime/sections/form/date_field_section.rb
motion-prime-1.0.3 motion-prime/sections/form/date_field_section.rb
motion-prime-1.0.2 motion-prime/sections/form/date_field_section.rb
motion-prime-1.0.1 motion-prime/sections/form/date_field_section.rb
motion-prime-1.0.0 motion-prime/sections/form/date_field_section.rb
motion-prime-0.9.9.2 motion-prime/sections/form/date_field_section.rb
motion-prime-0.9.9.1 motion-prime/sections/form/date_field_section.rb
motion-prime-0.9.9 motion-prime/sections/form/date_field_section.rb
motion-prime-0.9.8 motion-prime/sections/form/date_field_section.rb
motion-prime-0.9.7 motion-prime/sections/form/date_field_section.rb