Sha256: 31f1bf88c22aaefb443b872e2b3d9ec3cb9cc04b8a0cc0000658213efdf0bffa

Contents?: true

Size: 452 Bytes

Versions: 5

Compression:

Stored size: 452 Bytes

Contents

module Trestle::Form::Fields::DatePicker
  def normalize_options!
    unless options[:prepend] == false
      options[:prepend] ||= options.delete(:icon) { default_icon }
    end

    if enable_date_picker?
      options.reverse_merge!(data: { picker: true, allow_clear: true })
    end

    super
  end

  def default_icon
    icon("fa fa-calendar")
  end

  def enable_date_picker?
    !disabled? && !readonly? && options[:picker] != false
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
trestle-0.9.8 lib/trestle/form/fields/date_picker.rb
trestle-0.9.7 lib/trestle/form/fields/date_picker.rb
trestle-0.9.6 lib/trestle/form/fields/date_picker.rb
trestle-0.9.5 lib/trestle/form/fields/date_picker.rb
trestle-0.9.4 lib/trestle/form/fields/date_picker.rb