Sha256: c0622b7784f2a48e45ddd6019c3a17c229284535bb04ecb193bb3a535889b471

Contents?: true

Size: 719 Bytes

Versions: 9

Compression:

Stored size: 719 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_render :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

9 entries across 9 versions & 1 rubygems

Version Path
motion-prime-0.9.6 motion-prime/sections/form/date_field_section.rb
motion-prime-0.9.5 motion-prime/sections/form/date_field_section.rb
motion-prime-0.9.4 motion-prime/sections/form/date_field_section.rb
motion-prime-0.9.3 motion-prime/sections/form/date_field_section.rb
motion-prime-0.9.2 motion-prime/sections/form/date_field_section.rb
motion-prime-0.9.1 motion-prime/sections/form/date_field_section.rb
motion-prime-0.9.0 motion-prime/sections/form/date_field_section.rb
motion-prime-0.8.12 motion-prime/sections/form/date_field_section.rb
motion-prime-0.8.11 motion-prime/sections/form/date_field_section.rb