Sha256: 6c24120178da80e8df91d33b8160860614c4ab0a228d030d1a27b6f321a5fc5e

Contents?: true

Size: 749 Bytes

Versions: 13

Compression:

Stored size: 749 Bytes

Contents

module ActiveAdmin
  module Inputs
    class DatepickerInput < ::Formtastic::Inputs::StringInput
      def input_html_options
        super.tap do |options|
          options[:class] = [options[:class], "datepicker"].compact.join(' ')
          options[:data] ||= {}
          options[:data].merge! datepicker_options
        end
      end

      # Can pass proc to filter label option
      def label_from_options
        res = super
        res = res.call if res.is_a? Proc
        res
      end

      private
      def datepicker_options
        options = self.options.fetch(:datepicker_options, {})
        options = Hash[options.map { |k, v| [k.to_s.camelcase(:lower), v] }]
        { datepicker_options: options }
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
activeadmin-2.8.0 lib/active_admin/inputs/datepicker_input.rb
activeadmin-2.7.0 lib/active_admin/inputs/datepicker_input.rb
activeadmin-2.6.1 lib/active_admin/inputs/datepicker_input.rb
activeadmin-2.6.0 lib/active_admin/inputs/datepicker_input.rb
activeadmin-2.5.0 lib/active_admin/inputs/datepicker_input.rb
activeadmin-2.4.0 lib/active_admin/inputs/datepicker_input.rb
activeadmin-2.3.1 lib/active_admin/inputs/datepicker_input.rb
activeadmin-2.3.0 lib/active_admin/inputs/datepicker_input.rb
activeadmin-2.2.0 lib/active_admin/inputs/datepicker_input.rb
activeadmin-2.1.0 lib/active_admin/inputs/datepicker_input.rb
activeadmin-2.0.0 lib/active_admin/inputs/datepicker_input.rb
activeadmin-2.0.0.rc2 lib/active_admin/inputs/datepicker_input.rb
activeadmin-2.0.0.rc1 lib/active_admin/inputs/datepicker_input.rb